playMaker

Author Topic: Problem with raycasting from child of controller  (Read 1318 times)

BDFgames

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Problem with raycasting from child of controller
« on: November 21, 2016, 06:29:54 AM »
Hi there. I've got a problem where raycasting from a game object (specifically, a gun model's bullet spawn point) always seems to use the localspace coordinates, the result of which is that the ray's origin is always 0, 0, 0 (the centre-floor of the Vive play area).

It doesn't seem to matter if I try to use the bullet spawn point as a "hardcoded" Game Object or create a Game Object variable and refer to that, I just can't seem to get it to draw the ray from the actual Game Object -- it always draws it from the floor.

Even weirder, I seemed to "fix" this problem a week ago in one scene (by accident -- I have no idea what I did, but it seemingly started working as you'd expect it to), but when I copy the exact same SteamVR camera rig into a new scene, the origin problem occurs again.  :S

I know this has to be user-error on my part, but I'm stuffed if I can figure out what I'm doing wrong.

Any hints or tips gratefully received. Thanks in advance for your help.  :)

BDFgames

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #1 on: November 27, 2016, 07:06:28 PM »
Please forgive the bump. I take it no one's seen this problem before?  :(

Here's a screenshot, in case it helps.
« Last Edit: November 27, 2016, 11:03:58 PM by BDFgames »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #2 on: November 28, 2016, 01:16:42 AM »
Hi,

 can you show your raycasting action setup?

how do you compute the direction itself?

Bye,

 Jean

BDFgames

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #3 on: November 28, 2016, 01:47:04 AM »
Hi Jean. Thanks for your help.  :)

Here are a few screenshots of the FSM, action and relevant Game Objects. Hope this gives some context.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #4 on: November 28, 2016, 02:00:22 AM »
Hi,

 ok, thanks. so you do indeed have "Self" turned on, so this will be using the direction 0,1,0 from that "bullet spawn point".

 if that's not what you want, then you first need to compute the direction prior using this action, and turn the space property to "world", then you can fire a ray to any position, regardless of the local space.

Bye,

 Jean


BDFgames

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #5 on: November 28, 2016, 02:09:28 AM »
Hi Jean.

I think we're talking about different things. Both the ray and the bullet objects the gun fires (as a visual player aid) go the correct direction--it just starts (origin) on the floor instead of at the Bullet Spawn Point object. The ray is essentially in parallel with the line it should be on.

Unity seems to believe the Bullet Spawn Point object is on the centre-ground of the Vive play area instead of where it's actually located, as the child of the gun object.  :S

And, as mentioned, this exact same setup works perfectly in another scene, with the bullet objects and the ray spawning at the correct point--and I copied this rig from that scene into this new scene as-is!

I seriously cannot see any reason why it is using the wrong origin. It's very weird.  :S

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #6 on: December 02, 2016, 01:15:31 AM »
Hi,

 it's too bad I don't have a vive to test this on...

I would do the following: put some dummy sphere where you think things are so that visually you know where your positions and directions are, it helps figuring out what's wrong for me when I am in a case like that.


Bye,

 Jean

BDFgames

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #7 on: December 02, 2016, 03:40:51 PM »
Thanks, Jean. Yes, that's essentially how I figured out what was going on.

I still haven't figured out why it happens, but I've at least figured out what I need to do to fix it when it does, and I've now streamlined that process so it's far less arduous than it was.  :)

Thank you for trying to help, anyway.

And, on a side note, I want to thank you for all the many, many posts and tools I've found from you around the Web and on the Ecosystem—you've made learning the ropes with Playmaker 10,000 times easier.  :)

Cheers!
Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #8 on: December 13, 2016, 02:04:33 AM »
Hi,

 You're welcome, this is actually produced with your license purchase, so you should thank Alex Chouls and HutongGames as well :)

Bye,

 Jean

westingtyler

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #9 on: April 01, 2017, 11:47:59 AM »
how do we find alex chouls and hutong to thank them as well? Alex's twitter seems to have never been posted to.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Problem with raycasting from child of controller
« Reply #10 on: April 04, 2017, 10:48:33 PM »
Hi,

Alex Chouls twitter account is hutongGames twitter account so you can thank him there, he's also on this forum as a member of course :)

 Bye,

 Jean