Physics Movement without Physics Reactions
I have a Player object which rotates around another object named Centre. The player rotates around the Centre object using Torque, with its Centre of Mass set to the Centre object. Enemy objects are instantiated off-screen and given one dose of Force on creation in the direction of the Centre object. The player must navigate the Player object around the Centre object to block Enemy objects from reaching the Centre object.
To give an example which might be easier to visualise, imagine, on a 2D plane, a moon (Player) navigating clockwise and anti-clockwise around a planet (Centre). Meteors (Enemies), with no drag in space, are hurtling towards the planet, and the moon must be directed around the planet to intercept these meteors.
I've created a small prototype of this, but I'm having physics issues. The Player object moves as intended, as do the Enemy objects. The problem is that I want the Enemies to collide off the player and bounce away, whilst the Player object remains in its position; unaffected positionally by the collision. Currently, the Enemy objects collide with the Player object which causes both the Enemy and the Player to bounce off in different directions.
I would like the Player object to have player-controlled physics movement and collisions, but for it's position to not be affected by collisions, if anyone knows how to do this.
Apologies if I have not explained myself well. Thanks in advance for any help! :)
Answer by nt314p · Aug 27, 2017 at 11:05 PM
If the player has a rigidbody, take it off.
This might mess up your code a bit so you might have to rotate the player using transform.Rotate
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html