playMaker

Author Topic: Rotate to Direction  (Read 4161 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
Rotate to Direction
« on: September 18, 2012, 07:33:05 AM »
Long time no see,
I've worked on a couple of projects recently and have created a bunch of various handy actions. I forgot which they are though, so if I find them I'll post em here. I didn't intend to be selfish :)

This one took me quite a long time to figure out, despite it being utterly simple. If you want to rotate an object to a normal value you got from a raycast (eg. for simple decals), use this :) . No up/down values etc.
You can also use it to calculate the global rotation of a direction, without the single use of transformation matrices or complex angle calculation.

Best,
Sven

Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Re: Rotate to Direction
« Reply #1 on: September 21, 2012, 01:00:44 PM »
Thanks for sharing  ;)

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Rotate to Direction
« Reply #2 on: June 22, 2013, 02:42:17 PM »
Yes, thanks for sharing, and though this is an old post, I hope theres someone out there :)

I want to make "ground hugging"; In front of my "car" I have placed a GameObject that fires a ray down.

I need to use the angle of what it sees to spin my "car" to match the angle of what is in front.

As I understand things, your scrips should help - but I cannot figure out what is in and out here.

Thanks.

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Rotate to Direction
« Reply #3 on: June 22, 2013, 02:51:06 PM »
OMG, THIS IS FANTASTIC!

Just do a raycast, the variable "Store Hit Normal" goes into your "Direction", and voila!

Playmaker guys, if you are out there: This really should be implemented, so simple, yet so complex - and here is the solution, thank you kiriri from long time ago!!