The most basic collisions

SRt

10-05-2007 10:47:33

I want to use OgreNewt just for detecting collisions so that entites won't go through the terrain and won't move into each other. I don't want them to bounce once they collide and so on. And also perfomance is really important I'd like to turn all the unnecessary things which may be turned on by default. And also I don't really get how to let OgreNewt know that one object isn't supposed to move until player moves it, so that OgreNewt wouldn't change object's coordinates unless player himself does or a collision occurs.

What's the way to do it?

Sorry for my stupid questions I'm not that familiar with this library. Thanks in advance for your help.


*Update

Collisions don't seem to work :( I've turned debug lines on and all collision bodies are ok but still they don't collide. I use tBody->setPositionOrientation(tNode->getPosition(),tNode->getOrientation());
to update rigid body's coordinates each frame but the body still can go through walls

*Update

OgreNewt::Body::setVelocity() doesn't work as well :( I set the speed but collision body doesn't move (according to debug lines). I think I'm doing everything right I added mWorld->Update(evt.timeSinceLastFrame); to frameStarted function but nothing works so far :(

*Update

Where're you, walaber :( I need you so much

SRt

10-05-2007 20:06:25

For example the following code doesn't work


mWorld = new OgreNewt::World();
Ogre::Vector3 size(100.0,100.0,100.0);
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Box( mWorld, size,Ogre::Quaternion::IDENTITY, Vector3(0,200,0) );
OgreNewt::Body* floorbody = new OgreNewt::Body( mWorld, col );
floorbody->setVelocity(Vector3(0,50,0));


The body shows up but doesn't move.

I call mWorld->update(dt); every time in frameStarted function.

p.s. Sorry for the double post I didn't mean to do it

p.p.s. this forum is so... dead?

walaber

11-05-2007 02:32:38

for an object to move, you need to set the mass of the object. have a look at the demos, there is a certain amount of data you need to set before things will work properly.

SRt

11-05-2007 14:24:48

for an object to move, you need to set the mass of the object. have a look at the demos, there is a certain amount of data you need to set before things will work properly.

Well I've set the mass of the object and now it seems more like working at least something happens but still that's completely not what I want. I want to make it so that Newton only checks collisions and when a collision occurs it changes object's coordinates so that they wouldn't intersect. I've searched a lot but didn't find anything related to my problem.

Basically now I have a level entity which I load to newton using OgreNewt::CollisionPrimitives::TreeCollision and a charecter entity which I represent as bounding box. I can control my character but I want to make sure that he doesn't go through walls. Any ideas how to implement this?