- Home /
Drag area from HUD
Hi, I have a 2d physics game where you drag certain objects from an area on the bottom of the scene into the game, I want it so that obviously at runtime the objects start in this 'HUD' area, and are kinematic, so they don't drop down, but you can drag them up through the ground collider and when they enter this area they become non- kinematic and won't fall back through the ground. I was thinking of having a drag rigid body script, and disabling the collider on each object, and when it enters a trigger area (i.e. the game area above the HUD), the collider is activated, and then the isKinematic = false. However I now realise that drag rigid body scripts don't work with kinematic game objects, and I'm really stumped.. any ideas on how to go about this??
if you uncheck "use gravity" it won't drop down. Is there some other reason you wanted it to be kinematic? If you want to ignore the ground, and turn on collision once it's up, you could use a collision layer that ignores the other layers, then change the layer when it's in place to one that sees the rest, as in: GameObject.layer = 10; (or whatever)
Of course, I've always changed the gravity values to 0, so it sort of hovers a bit but wobbles around, thanks a lot. And the layer change will work perfectly, post it as an answer if you want me to mark it up :) thanks a lot Seth.
Answer by Seth-Bergman · Apr 30, 2012 at 06:54 AM
if you uncheck "use gravity" it won't drop down. Is there some other reason you wanted it to be kinematic? If you want to ignore the ground, and turn on collision once it's up, you could use a collision layer that ignores the other layers, then change the layer when it's in place to one that sees the rest, as in: GameObject.layer = 10; (or whatever)
Edit: Sure thing.. in case there is still any such wobble issue, you could always leave it as kinematic until being clicked/touched.