Add
New Member
Posts: 1
|
Post by Add on Aug 4, 2004 16:24:47 GMT 1
How can i make a camera or an object run over a level using the collision commands??
the levels are .X format. Can someone help me???
|
|
|
Post by Kjelle69 on Aug 7, 2004 2:32:09 GMT 1
are you talking about DBPro commands or Newton commands?
with Newton, the simplest way is to make a sphere rigid body, and update the camera to the body's position.
|
|
|
Post by zircher on Aug 9, 2004 17:59:32 GMT 1
I added some .X based terrain to my snake demo this morning and got it to work just fine. Since my terrain model was really huge and I did not want to re-do it, I needed to scale the model. So, I have some extra steps where I load the model, scale it, convert the model to a mesh, and then back to a new object that I use for the collision tree.
Extra comments added. If you have any questions, feel free to ask.
rem terrain ObjNum = 32001 if object exist(ObjNum) = 0 then load object "terrain.x", ObjNum rem model is 50x too big scale object objnum, 2,2,2 rem while I hide it for now, I really should delete it after rem I'm done making a mesh out of it hide object objnum if mesh exist(1) = 0 then make mesh from object 1, 32001 ObjNum = 32002 rem image 1 is the generic floor texture if object exist(ObjNum) = 0 then make object 32002, 1, 1 cube = NDB_NewtonCreateTreeCollision(objnum) Body = NDB_NewtonCreateBody(cube) rem I'm using tile-able .X terrain so I need to offset this rem 350 units west and 30 units down to match the rem then main test area created earlier. NDB_BuildMatrix 0.0, 0.0, 0.0, -350.0, -30.0, 0.0 NDB_NewtonBodySetMAtrix Body position object ObjNum, -350.0, -30.0, 0.0 rotate object ObjNum, 0.0, 0.0, 0.0 NDB_BodySetDBProData Body, ObjNum NDB_NewtonBodySetDestructorCallback Body
-- TAZ
|
|
|
Post by Kjelle69 on Aug 9, 2004 19:17:31 GMT 1
i was thinking about it, and I suppose I could have the wrapper check the object scale when it makes the TreeCollision, and adjust the collision data accordingly. it wouldn't be too hard, and would save some work for the user.
I'm swamped with work, but I'll try adding it in next time I have a chance.
I also need to add in the Serialize functionality, which basically allows you to load the TreeCollision data directly from a file, which is MUCH faster than building the data at runtime. for games with big levels that need to be added/deleted on the fly, it's an important feature. I'll probably add a few functions for saving out compiled TreeCollision data, and another function for loading it in... it's one of the few features in Newton I haven't put in the wrapper.
|
|
|
Post by zircher on Aug 9, 2004 22:11:32 GMT 1
Coolness, good to see those ideas going into to the to-do list. For the small levels in a contest entry, I don't think it will be a show stopper. -- TAZ
|
|
|
Post by Kjelle69 on Aug 9, 2004 23:56:45 GMT 1
assuming I don't run into any major problems, I should be able to have a release with these features out within a few days. ;D
|
|