Walk on a shape

Software: Away3D 4.x

2smacks, Newbie
Posted: 29 October 2011 12:00 PM   Total Posts: 9

Hi, please excuse my poor english.

I just want the player can walk on a shape, and can’t walk out.

In 2D I will used bitmapData.getPixelAt to know if I’m in the good zone or not.

Is there anything like that for Away3D ?

 

   

Avatar
Alejandro Santander, Administrator
Posted: 29 October 2011 06:00 PM   Total Posts: 414   [ # 1 ]

Hi 2smacks,

Well, you could use the same principle in the XZ plane. Why not?

You could also use AwayPhysics and have some real collision with your scene using primitives or triangle meshes.

   

2smacks, Newbie
Posted: 30 October 2011 04:59 PM   Total Posts: 9   [ # 2 ]

The same principe ?

I don’t see any plane.getPixelAt or anything like this.

I think I don’t have to use awayPhysics just for that, no ?

   

Avatar
Alejandro Santander, Administrator
Posted: 30 October 2011 05:09 PM   Total Posts: 414   [ # 3 ]

Well, you could say that using AwayPhysics might be overkill, and you may be right, but given its performance, you would probably just plug it in and it would work without affecting the rest of your application… so its up to you.

What I meant by using the same method as in 2D is this: given the transformation you’ve given to your plane, you can calibrate a method (not necessarily going through the rendering pipeline) to translate the position of your character to a pixel in the image which controls your collision. Just like in 2D.

If your image is 512px x 512px and you use it on a plane 5120w x 5120h, then when the character is at x = 2560, y = 2560, that would translate to a pixel at x = 256, y = 256. You would read the value of the pixel and apply your physics. All this ignores the y coordinate, so that’s why I say you can use the same principle.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X