Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collision

Status
Not open for further replies.

Baixinha

Programmer
Dec 27, 2000
122
BR
I need to create an object like a wall where other object can't pass thought neither enter a little into it. Anybody knows how can I do this? I'm crasy.
 
Doing collison depends, are you doing this as 2 sprites intersecting or in a 3D world when 2 models collid?

In the first case, which I think is the case you need help on:

assume 'ball' is a sprite, and that 'wall' is another sprite.


if sprite ball intersects sprite wall then


This IF statement will see if one sprite collides with another.


If you want to do this in director 3D then do the following:

assume 'obj1' and 'obj2' are references to models in the 3d world ( member(which member).model(which model).


ob1.addModifier(#collision)
ob1.collision.mode = #mesh --Can also be box or sphere
ob1.collision.enabled=true

ob1.collision.setCollisionCallBack(#collision, me)

then write a handler which will execute any code you want to happen on collision (on collision me). See macromedia's 3D help section on more info on this stuff.

 
I did this, but my problem is in avoid that the sprite 1 pass into the sprite 2. I'd like to create something like a wall to do this.
 
I did this a while back. I used a dummy object that I moved first, did my check, if no collision then I moved it, if there was a collision I moved the other object to the very edge of the collision object. It worked unless the object moved too far in one step and cleared the wall in one go. Should be able to avoid this by setting a max distance per jump less than the width of your walls.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top