playMaker

Author Topic: Collision info contact normal  (Read 3143 times)

Thomas Lilja

  • Playmaker Newbie
  • *
  • Posts: 4
Collision info contact normal
« on: January 31, 2015, 10:35:57 AM »
Hi guys,
I'm completely new with playmaker so this might be a very trivial question. I'm spawning an object with force that collides with a surface. On collision i want to spawn an effect that is aligned with the surface normal. According to the wiki, "get collision info"'s contact normal is what i need, but it doesn't seem to do anything. I guess it's not as easy as Unity using quaternion and i need to convert to euler for playmaker to recognize? 



Thanks!

boragungor

  • Playmaker Newbie
  • *
  • Posts: 17
  • Who really wrote Beethoven's music to begin with?
Re: Collision info contact normal
« Reply #1 on: January 31, 2015, 11:18:43 AM »
Hi,

Did you try by assigning an empty gameobject as a spawn point ?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Collision info contact normal
« Reply #2 on: January 31, 2015, 01:09:17 PM »
You're getting the direction that the face is looking, its not the same as a rotation. It's not going to do what you want.

Maybe try Smooth Look At Direction? Off the top of my head I'm not sure if there is a better solution for this that is as simple as that.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Re: Collision info contact normal
« Reply #3 on: January 31, 2015, 05:17:23 PM »
Hi Thomas,

You're on the right track! I use this system to create footprints for my characters. First, store the normal, like you are doing. Then just feed that normal into this custom action:

RotateToDirection


Easy!


SeanC

Thomas Lilja

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Collision info contact normal
« Reply #4 on: February 01, 2015, 12:07:24 AM »
Thanks a lot for the quick reply Sean!

I still don't get any rotation. Maybe i'm applying it to the wrong object somehow?



Do i need to get the clones particle effect and put that in the Game Object slot? Or perhaps do this directly in an FSM on the particle effect it self instead of the bullet?

Cheers!

Thomas Lilja

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Collision info contact normal
« Reply #5 on: February 01, 2015, 12:13:14 AM »
Hey. That worked! I saved the hitnormal in a global variable that i call from an FSM on the particle effect. Beautiful.

Thanks a lot for the help!

Thomas Lilja

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Collision info contact normal
« Reply #6 on: February 01, 2015, 08:26:49 AM »
One word of advise from our lead coder for n00bs like me "global variables are bad". Global anything is bad if it's not totally necessary. What that means is that your event will send updates to every script in the game every time it updates. That's obviously very bad for performance. 

I guess "Get Fsm Vector3" would be a better way? But why doesn't my variables show up if i don't make them global?