Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: VictorRayDev on November 10, 2014, 10:41:25 AM

Title: Add Force Local *2d Physic*
Post by: VictorRayDev on November 10, 2014, 10:41:25 AM
Hi!
I'd need this action please.
http://docs.unity3d.com/ScriptReference/Rigidbody2D.AddRelativeForce.html

Currently the addforce 2d is not relative to the rotation of the object.

I'm doing a little 2d golf game and I'd need to add the force relatively to the rotation of the ball.
Maybe it is already possible but I don't see a way to do it.

Thanks guys!  8)
Title: Re: Add Force Local *2d Physic*
Post by: nick_h82 on November 10, 2014, 02:33:57 PM
Hi,

I solved this with the trig actions- not exactly what you're asking but it would be a solution:
 
http://hutonggames.com/playmakerforum/index.php?topic=5677.msg27322#msg27322

Cheers,

Nick
Title: Re: Add Force Local *2d Physic*
Post by: VictorRayDev on November 10, 2014, 02:40:35 PM
it is a little bit complex for something to be so simple via local force :P.

I'm going to give your technique a go.
Title: Re: Add Force Local *2d Physic*
Post by: nick_h82 on November 10, 2014, 02:59:09 PM
Yeah- it is fairly complex, but in the end neater than trying to make the rotation do what you'd want. I would guess you're only applying the force for one frame when you hit the ball, otherwise be sure to run the trig equations every frame if you're varying the angle or force.
Title: Re: Add Force Local *2d Physic*
Post by: VictorRayDev on November 10, 2014, 04:17:30 PM
Thanks Nick! Followed your instruction work perfectly!
Title: Re: Add Force Local *2d Physic*
Post by: nick_h82 on November 10, 2014, 05:11:21 PM
Cool, glad to hear!