making projectiles

SteelX

28-09-2008 22:51:34

Hi, i know i need use Kinematic actors to reach this but i need some newbie help how kinematic actor works.

could you provide me some noob example ??


regards

SteelX

30-09-2008 02:55:26

well no body response me..... :(

then i paste some code about projectiles, i'm just only triyng to make some shoots. here is the code:




Ogre::Vector3 pos(0, 0, 0);
//actparams.mBodyFlags =NxOgre::NX
NxOgre::Actor * lanza = m_physxScene->createActor("lanza; lanza.mesh",new NxOgre::Convex( m_lanzaMesh ),
pos );

// lanza->raiseBodyFlag( NX_BF_KINEMATIC );

lanza->setGlobalPosition( mMainNode->getPosition() );
lanza->setCMassGlobalOrientation( mMainNode->getOrientation() );
lanza->setGlobalOrientation( mMainNode->getOrientation() );
lanza->setLinearVelocity( Ogre::Vector3( 70.0f ));



when i uncomment lanza->raiseBodyFlag( NX_BF_KINEMATIC ); the projectile is static but has orientation otherwise shoots any place.

Prophet

30-09-2008 08:21:26

If we are talking normal FPS, I strongly urge you not to use Convex-shapes for projectiles. Use either box or raycasting. But, if you are creating huge irregular rocks that you will throw at your enemy, then it's a different story.
Nevermind, it was kinematic actors and static objects.

SteelX

02-10-2008 03:27:46

thanks prophet you mean if i use box or a capsule shape the projectil could move???

i'm trying with raycast now, wtih an snippet i found here i can intersect some objects but if i want the objects be moved with the bullet impact is hard to do.

so i'm still need to launch stuff like misiles. i hope some NxOgre documentation too. :roll:

mcaden

02-10-2008 04:21:03

You could use the raycast and use addForceAtPos(...) where the ray hits - at least I think that's the usage.

Other projectiles like missiles will probably need to use CCD and you will probably want to use a cube that takes the same shape as the mesh's bounding box.

Prophet

05-10-2008 14:10:45

Using custom collision shapes requires a lot more of calculation to be done by the computer than the use of primitive shapes, recommended boxes.
McAdens advices, I recommend.