|
|
是这样的,汽车撞到路障上,要求汽车震几下,然后停止,现在呢,是震完后开始无规则运动,我想把无规则运动给去掉,只保留"震"的效果,
其中路障的刚体在Application中的CreateScene()函数中,代码:
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Cylinder(m_World, 2.5, 5);
OgreNewt::Body* bod = new OgreNewt::Body( m_World, col );
delete col;
bod->attachToNode( pNode_lumian );
而汽车的牛顿和刚体在listener中的framestart中的,代码:
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Box( m_World, pNode_che->getPosition());
body = new OgreNewt::Body( m_World, col );
delete col;
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcSphereSolid( 1.0, 1.0 );
// attach to the scene node.
body->attachToNode( pNode_che );
body->setMassMatrix( 10.0, inertia );
body->setStandardForceCallback();
//pNode_che->setPosition(camPos2.x,camPos2.y,-1380.0f);
body->setPositionOrientation( pNode_che->getPosition(), orient );
|
|