playMaker

Author Topic: Raycast inconsistent? Bouncing off walls erratic! Help! [SOLVED]  (Read 1485 times)

homeworld

  • Playmaker Newbie
  • *
  • Posts: 39
Raycast inconsistent? Bouncing off walls erratic! Help! [SOLVED]
« on: December 27, 2017, 07:25:23 PM »
Hi! I've been trying to make my player character be able to propel off walls, by calculating a reflected vector3 from a raycast and moving the controller in that direction; here's my state:



This works fine, however, every time i change the collider that the player is bouncing off of, it seems to use the information in the previous "bounce", which leads to a bad result; I have no idea why this is happening.

I'm attaching a video of the problem; note that everytime i change collider (go to a different wall), it seems like it's using the previous jump's coordinates.

https://giant.gfycat.com/ImpassionedLividHoki.webm

Any help would be appreciated! Am i doing something wrong?
« Last Edit: December 29, 2017, 09:00:51 AM by homeworld »

homeworld

  • Playmaker Newbie
  • *
  • Posts: 39
Re: Raycast inconsistent? Bouncing off walls erratic! Help!
« Reply #1 on: December 29, 2017, 07:44:28 AM »
Narrowed it down to the reflected variable not updating for some reason, so the ease action would always ease the previous reflected vector, not the current one; fixed it by adding a next frame event after the reflect calculation. Neat!

Not sure why this happens, but it's a decent fix :)