Move + Aim Phys Object Accurately

Get help using Construct 2

Post » Thu Mar 14, 2013 10:41 pm

If I wanted to drag a phys pistol anywhere on the screen, making it accelerate towards and aim towards the mouse pointer, stopping acceleration when it reaches the pointer so you have an accurate shot, how would I go about stopping it's movement?

The problem I'm having with this is that I can drag, drop and move the gun just fine, but once it gets to the mouse it starts doing loopies around the mouse position, or if I make it so it can't do that, it just starts falling downwards because of the phys gravity, still aiming towards the mouse pointer. There doesn't seem to be a way to disable or enable physics/set the gravity of a single object, otherwise this would be a lot easier for me.

Anyone have any suggestions?
Posts: 234
Reputation: 3,467

Post » Fri Mar 15, 2013 6:34 am

If it's a physics object it'll have a couple of built-in variables that are useful , VelocityX and VelocityY. If you can get these to decelerate properly, you can have a trigger that is checking if the pistol has been fired but the VelocityX is below a threshold, then use the action "Physics: Object settings Set immovable". If the velocity checking is not a route you'd like to go you can have it check a threshold distance from your mouse pointer (Mouse.X/Mouse.AbsoluteX) and use that to trigger the physics object immovable. Good luck!

Posts: 24
Reputation: 4,059

Return to How do I....?

Who is online

Users browsing this forum: DanielSP, Draconiz717, Maxum, nanogod, oosyrag, ridhoemgl and 7 guests