playMaker

Author Topic: Align Object To Surface Normal?  (Read 4895 times)

polygon

  • Playmaker Newbie
  • *
  • Posts: 18
Align Object To Surface Normal?
« on: October 13, 2014, 01:34:38 PM »
Hi,

I want to create a hovercraft-like effect and in order to do this I have to align the vehicle to the surface which is below the hovercraft. So I played around with the raycast action a few hours but couldn't get any results :(

Here's a reference video that comes very close to what I'd like to achieve:

The main problem is that I can't figure out how to use the information from the raycast action to align (rotate) another object based on the normal directions.

Can anyone help me with this?

Best regards,
Daniel




Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Align Object To Surface Normal?
« Reply #1 on: October 14, 2014, 07:46:39 AM »
The trouble with aligning to one normal below you is that its potentially very unstable. Where is the raycast coming from? Hovering along and coming up to a hill for instance unless the raycast is in the front then it'll probably ram any incline before the raycast hits it and reacts. What if you flew over small rocks? You'd be rolling around like crazy.

I remember seeing these videos a long time ago, and I think he has more that explains what he did to make this. iirc he put 4 raycasts, one at each corner, and either added force to points based on the distance they were returning or he averaged them out somehow to come up with an estimated safe normal direction for the ship to be set at.

Most of this sort of stuff is just smoke and mirrors, its just a matter of experimenting until you get something that is acceptable.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

GOD

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Align Object To Surface Normal?
« Reply #2 on: November 08, 2016, 11:29:23 AM »
The trouble with aligning to one normal below you is that its potentially very unstable. Where is the raycast coming from? Hovering along and coming up to a hill for instance unless the raycast is in the front then it'll probably ram any incline before the raycast hits it and reacts. What if you flew over small rocks? You'd be rolling around like crazy.

I remember seeing these videos a long time ago, and I think he has more that explains what he did to make this. iirc he put 4 raycasts, one at each corner, and either added force to points based on the distance they were returning or he averaged them out somehow to come up with an estimated safe normal direction for the ship to be set at.

Most of this sort of stuff is just smoke and mirrors, its just a matter of experimenting until you get something that is acceptable.

How is that answering the question? The question was about how to get the object to align to the surface normal. I am also wondering: HOW TO USE PLAYMAKER TO MAKE AN OBJECT ALIGN TO AN UNDERLYING SURFACE NORMAL?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Align Object To Surface Normal?
« Reply #3 on: November 09, 2016, 02:31:11 AM »
Hi,

You need to use the "Raycast" action coupled with GetRaycastHitInfo which contains the normal of a raycast Hit, and with this normal, you have the information to align an object with it.

I made a sample showing how to do this:

http://hutonggames.com/playmakerforum/index.php?topic=900.msg3781#msg3781

 Bye,

 Jean