Summary
Im trying to make a top down game, and I have implemented a mechanic which dash/teleports the player a short distance based on where the rotation of their player is. The twin stick controls seem to be working, and I can aim my player, my weapon fire etc where ever I want. For a short period, my dashes work and have proper rotation, but for some reason randomly my Yaw gets locked to 90 and nothing works anymore.
Please select what you are reporting on:
Creative
What Type of Bug are you experiencing?
Devices
Steps to Reproduce
- Add third person controls
- Add third person camera
- Add dash script and hook it up to input trigger that consumes Jump
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
dash_device := class(creative_device):
@editable
SpacebarInput : input_trigger_device = input_trigger_device{}
@editable
DashDistance : float = 600.0
@editable
DashDuration : float = 0.2
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
SpacebarInput.PressedEvent.Subscribe(SpacebarPressed)
SpacebarPressed(Agent:agent):void=
if (Character := Agent.GetFortCharacter[]):
Transform := Character.GetTransform()
# Get the forward vector in the direction the character is facing
Forward := Transform.Rotation.GetLocalForward()
# Calculate the target position by moving forward DashDistance units
TargetPosition := Transform.Translation + (Forward * DashDistance)
# Use TeleportTo to instantly move the character to the target position
#print the players rotation for debug purposes
RotationXYZ := Transform.Rotation.GetYawPitchRollDegrees()
if:
RotationYaw := RotationXYZ[0]
RotationPitch := RotationXYZ[1]
RotationRoll := RotationXYZ[2]
then:
Print("Player Rotation: Yaw: {RotationYaw} Pitch: {RotationPitch} Roll: {RotationRoll}")
if (Character.TeleportTo[TargetPosition, Transform.Rotation]):
# Teleport was successful
Print("Dash successful")
- Notice how after a short duration, the debug logs in the top left show Yaw rotation locked to 90 degrees
Expected Result
Rotation should respect where the player is actually facing in the viewport.
Observed Result
Rotation yaw gets locked to 90 degrees causing unexpected behaviors
Platform(s)
All