[Resolved] Problem with example: car falls trough the ground

Software: Away3D 4.x

Avatar
Dexx, Newbie
Posted: 08 September 2012 12:11 PM   Total Posts: 6

I was fiddling with the VehicleTerrainTest example and modified a few things. One of them were to make the world a bit more realistic by giving bigger depth to the ground. At line 104:

var terrain AWPTerrain = new AWPTerrain(bmaterialterrainBMD.bitmapData5000050005000020020012000false); 

I modified the height from 1200 to 5000 (4th attribute). I’ve also put the objects higher to be above the ground level. However everything is falling through it. If I put 3000 some objects get caught but the car, for example, still falls trough.

Does anyone know what could be the problem? Is this exact same behavior happening to others too?

   

Arno, Newbie
Posted: 10 September 2012 12:53 PM   Total Posts: 25   [ # 1 ]

I have the same behavior. I have a big terrain and i have the feeling that if the height is 0 the collision is detected. If there is elevation the collision is away.

If I use AWPBvhTriangleMeshShape i have the same problem. And with AWPBvhTriangleMeshShape if i do this _debugDraw.debugMode = AWPDebugDraw.DBG_DrawCollisionShapes; i get an error: RangeError: Error #1125: The index 0 is out of range 0.

   

John Brookes, Moderator
Posted: 10 September 2012 11:31 PM   Total Posts: 732   [ # 2 ]

Never understood the terrain mesh demo.
To me you should create a terrain using standard away and then pass that terrain geometry to a bvhTraingleMesh.

Dexx
Change the 8th parameter (1200) to match your 5000.
You may also need to set the terrainBody y lower.

An then if you want, change the terrain shape to
var terrainShape : AWPBvhTriangleMeshShape = new AWPBvhTriangleMeshShape(terrain.geometry);


Arno
The error is because debugDraw is trying to draw the traingles using segments and there too many of them for the buffer. As it stands not much you can do about that. Apart from hack at the debug class.

While on that subject.
If you get in the situation where say you wanted to debug everything else but triangleMesh or heightfield and cant because of that error
comment out lines
477-478 and 480-481.
in AWPDebugDraw

   

Avatar
Dexx, Newbie
Posted: 10 September 2012 11:50 PM   Total Posts: 6   [ # 3 ]

Thank you, this solved it for me. Can’t believe I missed something that simple.

   

Arno, Newbie
Posted: 11 September 2012 07:11 AM   Total Posts: 25   [ # 4 ]

thanks JohnBrookes. Now i have the AWPBvhTriangleMeshShape also working. My problem was different. I had a canon bullet that hits the surface of the terrain but if the Rigidbody is smaller than 100 pixels the bullet falls through the terrain without a collision. I think the bullet is falling to fast. My fix was to make the rigidbody bigger

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X