playMaker

Author Topic: Trouble spawning a GO at the point of trigger collision[SOLVED]  (Read 1067 times)

Alexroc

  • Playmaker Newbie
  • *
  • Posts: 2
Trouble spawning a GO at the point of trigger collision[SOLVED]
« on: January 22, 2019, 02:06:53 AM »
I currently have a scene where if I stab a trigger collider I can make an object spawn from the object that was stabbed. I need this object to be rotated in the direction of the point of contact that the 2 trigger colliders initially met. I think I just need "Create Object" to properly use "Rotation" and "Position" but it seems to not do anything with how I'm handling setting them.

I set the object being hit to "hitObject" and the hitting object to "hittingObject" and they both have isTrigger checked. As they make impact currently they do correctly send a message and events across - but it does not seem to rotate the spawning object to the point of contact.

I have 2 global variables for vector3 and vector3normal which I tried using with "Get Collision Info"'s 'Contact Point' and 'Contact Normal' and it did not work. Then I proceeded to try it with "Get Event Info"'s 'Get Vector3 Data' which it also did not work. By "did not work" I am assuming the data is not being saved, but I'm not sure how to check out what is currently being stored.

I've also tried taking the "hittingObject" and doing "Inverse Transform Direction", "Smooth Look At Direction", and "Smooth Look At". None of these I've been able to make the spawning object face the correct direction.

Does anyone know?
« Last Edit: January 22, 2019, 08:04:31 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Trouble spawning a GO at the point of trigger collision
« Reply #1 on: January 22, 2019, 02:44:12 AM »
Hi.

The get collision info will not work, as there is no collision when you set trigger.
But you can try setting isTrigger to false and isKinematic to true the use the collision actions.

if that don't work, maybe you can use a raycast.

I made a video recently using a raycast, maybe it can get you in the right direction :


Alexroc

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Trouble spawning a GO at the point of trigger collision
« Reply #2 on: January 22, 2019, 03:15:43 AM »
Thank you for the quick reply;

I understand. I usually do all this by hand but for ease of reading for team members we're using playmaker and the setup where I collide 2 rigid body non-isTrigger colliders is also not saving the information and using it. My problem is that I should be able to grab the information using Get Event Info and saving vector3 information or euler information (doesn't seem to be there for event info?) but those aren't seemingly happening using playmaker.

Raycasting looks interesting enough with playmaker but I'm not triggering an event to occur until the 2 objects collide and they must physically collide - and the event occurinng need to enter when they enter each other (doing a sword stabbing into an object thing). This is the reason I need the point of collision and the rotation of the entering weapon.

Edit: I ended up working on Raycasting through PlayMaker and found it far easier to use. It now does work and works properly for my setup. Thank you djaydino!
« Last Edit: January 22, 2019, 06:12:49 AM by Alexroc »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Trouble spawning a GO at the point of trigger collision
« Reply #3 on: January 22, 2019, 08:04:09 AM »
Hi.

Happy to help :D