playMaker

Author Topic: Ray Cast Bad Direction [SOLVED]  (Read 5813 times)

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Ray Cast Bad Direction [SOLVED]
« on: April 03, 2012, 08:04:54 PM »
Hi I´m working with the last PlayMaker and the official action of ray cast.
I have a gun that shots.From my Camera game object.My direction is 100 in Z axis. I checked debug ray in ray cast.
I ´m playing my game and I check this.At first time my gun shots in a good direction. But in the next shots the ray begin falling. It did´t shot and right direction.
Is this normal?
Can somebody help me?
Bye
« Last Edit: April 10, 2012, 12:50:48 PM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Ray Cast Bad Direction
« Reply #1 on: April 04, 2012, 01:29:15 AM »
Hi,

 How to get the direction for the raycast? Make sure for example that you use the local axis of anobject, not a global direction ( which as you turn your gun, the ray woudl still fire in the same world direction).

Bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #2 on: April 04, 2012, 07:08:09 AM »
Hi,

 How to get the direction for the raycast? Make sure for example that you use the local axis of anobject, not a global direction ( which as you turn your gun, the ray woudl still fire in the same world direction).

Bye,

 Jean

Yes, yes that´s it.Thank´s a lot Jean.Thank you very much! :)  :o
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #3 on: April 04, 2012, 09:29:22 AM »
Yes that was one of my problems.
But now why I have two lines?
http://www.youtube.com/watch?v=jng7GRO63AM
Only the up line is good. And the down line is bad.
Please help me.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Ray Cast Bad Direction
« Reply #4 on: April 05, 2012, 12:50:04 AM »
Hi,

 difficult to say with the video. It does seems like you might have a second raycast going on maybe in one of the impact gameObject

Bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #5 on: April 05, 2012, 07:08:58 AM »
Sorry Jean by the video.
I only have an ray cast.
I don´t know is happen.
I´m gonna remake the video.
Bye


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Ray Cast Bad Direction
« Reply #7 on: April 06, 2012, 07:25:14 PM »
Have you tried the updated Raycast action here:
http://hutonggames.com/playmakerforum/index.php?topic=1021.0

If that doesn't help, email me the project and I'll take a look...

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #8 on: April 06, 2012, 07:55:25 PM »
I´m sending

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #9 on: April 06, 2012, 07:59:22 PM »
Sent

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Ray Cast Bad Direction
« Reply #10 on: April 07, 2012, 06:27:02 PM »
The problem is the Rigid Body on the Player fighting with the Character Controller. The rigid body falls during Update and us then corrected in Late Update (I believe) by the Character Controller. If you remove the Rigid Body, or make it Kinematic, the Raycast behaves properly...

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #11 on: April 09, 2012, 07:08:40 PM »
Hi Alex.
Sorry but today I´m not on my computer.
Tomorrow I will be on it and I´m gonna try this.
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Ray Cast Bad Direction
« Reply #12 on: April 10, 2012, 12:16:45 PM »
Thanks a lot Alex now it works well
Thanks by your time.
Bye