playMaker

Author Topic: How Raycast work?[SOLVED]  (Read 22499 times)

FractalCore

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 100
Re: How Raycast work?
« Reply #15 on: December 09, 2011, 08:03:59 PM »
Not sure why your Look At is missing a Every Frame option. You might be using the Playmaker version before 1.2.1. And it is good to have, I tried turning it off and there was a slight lag in aligning the object to the hit normal. But it did still work.

I suggest turning on the Debug option in the Raycast and the Look At. Then if you drag the Game view to be there at the same time as the Scene view, like in this picture... When you hit play you'll be able to make sure the ray is firing the right way and you can also see the normal (grey line) that the box is aligning to. You can also move the "Lazer" and see it update in realtime.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: How Raycast work?
« Reply #16 on: December 10, 2011, 11:58:10 AM »
I have the last version of Playmaker and I don´t have this action

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: How Raycast work?
« Reply #17 on: December 10, 2011, 01:32:28 PM »
It´s working but bad
I will post a video

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: How Raycast work?
« Reply #18 on: December 10, 2011, 02:15:19 PM »

FractalCore

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 100
Re: How Raycast work?
« Reply #19 on: December 10, 2011, 09:26:38 PM »
Your Set Position Action is using the Hit Normal instead of the Hit Point. That might explain why the cube appears at the base of the raycast instead of where the ray hits something.

Eventually you'll want to replace that with a Create Object, set to create the hit result cube prefab you have. That's assuming you want to use this as a system for spawning a particle system and leaving a bullet hole or something.

But there appears to be other things that might be going wrong. You seem to have a ray that points to what could be world 0,0,0. That shouldn't happen.

And I'm not sure about the "Target" sphere, is it to visualize something? I didn't see anything using it in your FSM.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: How Raycast work?
« Reply #20 on: December 11, 2011, 06:53:38 PM »
"Target" sphere? Jean said only for we create it.
I have put my cube on prefab and added create object too but it´s the same
Bye
Thanks for any help

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How Raycast work?
« Reply #21 on: December 14, 2011, 07:21:32 AM »
Hi

Ok, I created a package showing the implementation so that you can study a working example and find out what could be wrong in your implementation.

 The post is here:
http://hutonggames.com/playmakerforum/index.php?topic=900.msg3781#msg3781

and the package actually available here:
http://dl.dropbox.com/u/17356625/Unity/projects/misc/raycast.unitypackage

Bye,

Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: How Raycast work?
« Reply #22 on: December 14, 2011, 08:54:04 AM »
Thanks Jean I will try
Bye