Hi.
First: Why should a rocket be kinematic?
You could create the rocket as a PxRigidDynamic actor, and set the gravity flag off and the
trigger flag ( of your shape ) on. Thus the rocket is non kinematic and you can move it
via addForce - to simulate a “starting” rocket - or something similiar which keep accelerating while
is flying. (if desired → and if it moves “slowly” so CCD must not turned on )
With the trigger shape its easy to do specific things which should happen when the rocket hits
a player or the ground etc.
It also fires an event when it enter a shape or leave it. Just play with it.
The best part of all is that the trigger shape needs an deactivated PxSimulationFlag - thus
your PxController wont move up when he is hit. And other good feature: You dont have
to call continuously setKinematicTarget() - just add force once and you are are done.
You can also set a filter flag for the rocket - and filter this inside your filtershader - but
I prefer the way with the trigger shape.
There is another option for the undesired behavior. You could raise some flags, or
using your filtershader to get the kinematic objects and set other flags for it, if you dont want
to change to trigger shapes.
I dont want to explain how you should do this - you should think about which way do you want to use.
Example: Look at the submarine source, the mines (and the chains) using trigger shapes too.
As I said in other posts before, the part where you updating your physics is very important.
Which timestep do you use? Fixed, semi fixed, … ?
With a wrong timestep everything should work fine, but sometimes (often while you have frame drops)
you have undesired behaivor like falling throu the ground / no collisions with items (no callbacks…) etc.
onShapeHit are called only when you called PxController::move().
Thus its not a good way to implement “hit code” when a rocket hits you.
When you stand and you got hit by a rocket - and didnt call move(), nothing happens.
This is another reason to use trigger shapes :)
Oh there was another question.
Hmmmm…
Why should you use a PxController for your camera?
You could also use another way to handle it - a trigger shape, a raycast … etc.
But okay. You want to use a PxController.
→ So your problem here is that your PxShape which is hidden in your actor which is created
by the PxController interacts with other controller. If you want to use the PxController -
you could set the PxController a filterflag which stands for: “never collide with other than the ground”. After you did this, you are done.
Or you set the PxShape to be an trigger shape - (but I guess the PxController can move trou the ground with that flag)
Another way is to create a simple cube and raise the trigger flag. ( lighter for the solver + slightly better performance )
(After you get a collision of the ground, you cant move deeper to it (raycast) )
Or directly usage of raycasts.
Or sweeps.
Depends what do you want to use it has different benefits.
Maybe for you its the best way to set a special filter flag, explainted above.
( Very very few code (changes) to implement this behaviour, but maybe not the best choice.)
I like raycast or a trigger shape. ← But it depends what do you want to achieve.
Of course, there are other ways to reach the goal - with other improvements.
I hope I could helped you a little bit.