playMaker

Author Topic: Raycast not working  (Read 402 times)

HeathClose

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Raycast not working
« on: June 10, 2018, 05:18:45 PM »
I have a 3d cube player model frozen in z pos and x y rot with 4 raycasts... imagine a slinky falling down the stairs... the raycasts should hit every time a new side touches the stairs...

I have the raycasts at 90 y -90 y and same for x... they debug exactly where they are supposed to be... the "stairs" are all labeled with the ground layer as set up in the raycast... but it never detects the ground layer... what is going on?

all 4 raycasts actions are in the same state looking for a detect before firing off the "on ground" event
« Last Edit: June 10, 2018, 05:20:19 PM by HeathClose »

drakwon

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: Raycast not working
« Reply #1 on: June 10, 2018, 09:03:43 PM »
are your physics settings correct?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3664
    • View Profile
    • jinxtergames
Re: Raycast not working
« Reply #2 on: June 11, 2018, 06:56:30 AM »
Hi.
have you tried the raycast in a separate fsm?

Maybe it never get called if the other raycast have a hit event.

HeathClose

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Re: Raycast not working - jump issue
« Reply #3 on: June 11, 2018, 11:48:03 AM »
i think what the problem was is that the debug is enormous compared to the actual ray being cast.  the debug was perfect at .065 but my cube is 1x1x1.  when I increased it to 1.1 the debug goes on forever, but it works.

new problem -  im setting up a jump mechanic so when the raycast2 action doesn't show a hit, it loops infinitly.

Tried to "controller is ground" after putting on a character controller but no matter what it never returns a grounded....

all i want is to be able to set up a jump with add force... grounded... able to jump... in air... double jump (which I can set up)... double jump exhausted?  cant jump until grounded... that's all i'm trying to do...

HeathClose

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Re: Raycast not working
« Reply #4 on: June 11, 2018, 05:00:34 PM »
I actually have the jump and double jump working.  The ray casts work now everything is golden - EXCEPT:  if I hit my square on the ceiling of the platform above me, since the whole platform is layered “ground”, I can infinitely double jump and hang from the ceiling... ie fly... how do I get it so the ceiling above my head doesn’t trigger a ray cast hit?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3664
    • View Profile
    • jinxtergames
Re: Raycast not working
« Reply #5 on: June 12, 2018, 12:26:40 AM »
Hi. are you using a raycast for the ground?

if so maybe you need to set the raycast position to the bottom part from you character and cast from there.

If you use collider/trigger then maybe best to change and use raycast OR use 2 colliders for the platform (ground collider and ceiling collider)