My projectiles will not move while using the kinematic body type. When using the dynamic they pop up then fall down but for the kinematic, they just stand still where ever they were cloned. I cant figure out why this is happening.
First of all check what are you moving is it instance of prefab or prefab asset in folder=D
This is common mistake when you apply force to prefab instead of instantiated object.
Assuming things are setup correctly that sounds like it is as should be expected:
Rigidbodies set as kinematic will not be affected by gravity /physics and unless you move them directly they will stay put . You could move them for eg using the translate method of their transform.
Rigidbodies that have the gravity option checked will right away start falling down by the action of gravity and keep falling till they hit something that stops them from moving on like a plane with a collider etc.
But if they have gravity set to off they too will stay put till they are hit by something (with a collider) or have a force applied to them.
For your projectile after you clone it into the scene with the gravity disabled and not set as kinematic you could apply a force in the direction you want it to fly off in using the forcemode impulse option as shown below.
rb = GetComponent<Rigidbody>();
rb.AddForce(transform.forward * 2f, ForceMode.Impulse); // applies 2 units of impulse force in the forward direction
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.