- Home /
Notional Map Boundaries and freezing Rigidbodies
Hi there,
....I’ve got the main chunks of my game coded and working. It’s a rough Desert Strike Clone and I’ve got a flying ship at fixed height, bullets, shields, refuelling stations and enemies, and a terrain painted out. Everything is working well, energy levels and HP go up and down, I have all the sliders I need to adjust gameplay, and I’m almost ready to start building the level completely.
Almost….
....I had a problem initially with the terrain collider, so I’d turned the whole thing off while I was developing. Now I’m trying to stop the ship flying into cliffs and such, I’ve turned off the “Is kinematic” option, locked the y (height) position, locked the x and z rotation (So just like desert strike, everything operates on a single plane). Initially, it seemed to work – a few test collisions with the terrain and the ship just stopped. However, once I started to move on and finish up the HP loss and death system, I hit huge problems.
....Now, whenever the ship gets hit, a couple of things happen. Firstly, it now has a permanent force applied to it so t continually moves – I don’t think this is going to be too bad as I’m sure I can sort out a workaround somehow using another collider to destroy the projectile before it actually connects with the non-kinematic one. Secondly, and more worryingly, getting his seems to break the position and rotation freezes I’ve put on the Ship. After a couple of hit’s I’m now pointed at the sky and crashing into the ground – after testing the terrain again I’ve discovered I can break the freezes there too if I persistently fly into the terrain and find shallow gradients to work my way up. The spin and Height issue is even more pronounced if I crash into a non-kinematic enemy – the ship almost immediately jumps to a different height.
....So, basically I’m guessing I’m doing something wrong at the fundamental design level. Should I be using something other than the physics engine to stop motion? Should I be fixing these things in the update function if parameters go awry? Have I got the wrong things as non-kinematic (Ship and enemies = non-kinematic, terrain and bullets = kinematic)?
....I’m sure these aren’t new issues – so any ideas?
....NB: the actual ship is encased in a box collider as I was hoping the flatter faces would stop rotation when collisions occur – the mesh for the ship just went everywhere as it’s a mess of oblique angles….
Your answer
Follow this Question
Related Questions
Rigidbody falling trough terrain 2 Answers
OnMouseDown not firing if character isn't touching ground 0 Answers
Compound colliders, what is the best implementation? 0 Answers
2d sprite falls through floor 0 Answers