Whilest testing my twin-stick-shooter game (blueprints) I stumbled across something weird.
I implemented a teleport function which uses node AddActorLocalOffset (see attachment).
Everything works fine if there is just one player. However if there is a second controller, teleport destination is exactly mirrored. This is especially strange because of LineTrace I’m doing right before teleport. It determines right position for teleport to end but player is instead teleported in other direction.
I attached some pictures of code and result.
Both players (green & red) where standing next to each other. Whilst green teleported in right direction, red teleported in opposite direction. And they were both facing same way.
Hope someone could enlight me if this is really a bug :->
I haven’t been able to reproduce this behavior on my end. My suspicion is that something about skeleton’s socket isn’t replicating properly, but I’m not sure. Are you able to reproduce this in a new project? If so, would you mind zipping it up and attaching it here, or uploading it somewhere and giving me a download link? Thanks!
Thanks for your reply. I will try to reproduce it for you in next days!
Edit: I guess I managed to reproduce it, but not quite in same manner. It now occures even without a second character and only when moving down (xbox 360 controller - left stick - down). Teleporting up works fine (its in direction line trace is firing) but not down. Use left trigger button to teleport. Hope that this may help you:
Let me know if it doesn’t “work” as I described it on your end.
Thanks for test project! It looks like only problem is that you’re using AddActorLocalOffset in your Teleport function, when instead you should use AddActorWorldOffset. Switch out those nodes and this should work both in single and multiplayer.
Hope that helps!
Thanks a lot! That’s it Could you please tell me difference between those two? I can’t seem to find anything about difference in documentation.
I’m sorry for inconvenience!
Absolutely not an inconvenience. There isn’t any documentation other than standard Blueprint API for these, but they may be helpful:
key difference is that Local usually refers to things within an Actor, relative to itself. There are instances where this doesn’t make sense, and so behavior can seem off. Instead, World refers to Actor relative to world around it. So when you offset an Actor by World, it takes difference and applies it to Actor’s Transform withing World, rather then relative to itself.
I hope that helps! Let me know if you have other questions.