0 votes

I hv created an rewind script and it works fine when it plays back position and rotation recorded when the object is in a state of motion but when it plays back the position and rotation recorded when the object is in a state of rest, the object gets stuck once it rewinds back to its original postion.

Here is my code pls help:-

extends RigidBody

var isrewinding: bool = false
var position: Array = PoolVector3Array()
var rot: Array = PoolVector3Array()

func _ready():
position = PoolVector3Array()
rot = PoolVector3Array()

func _record():
position.insert(0, transform.origin)
rot.insert(0, transform.basis)

func _rewind():
if isrewinding == true:
if position.size() > 0:
if rot.size() > 0:
transform.origin = position[0]
transform.basis = rot[0]
if position.size() > 1:
if rot.size() > 1:
if isrewinding == false:

func process(delta):
if Input.isactionjustpressed("za rewindo"):
isrewinding = true
elif Input.is
actionjustreleased("za rewindo"):
isrewinding = false

func physicsprocess(_delta):
if isrewinding == true:
elif isrewinding == false:

in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.