Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: homeworld on December 27, 2017, 07:25:23 PM

Title: Raycast inconsistent? Bouncing off walls erratic! Help! [SOLVED]
Post by: homeworld 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:

(http://danbkp.myqnapcloud.com/Web/2017-12-28_01-54-59.png)

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?
Title: Re: Raycast inconsistent? Bouncing off walls erratic! Help!
Post by: homeworld 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 :)