i need some code suggestions

im pretty new to javascript so i cant do everything. what i need help with is i have a rigid body cube that spawns but i want it to be sent forward at a slow speed almost like a spell. but when it hits something go back to being a physics cube, any help would be amazing

you can instantiate it and have a script attached that you call starts movement
if you want it be a spell like thing turn off gravity and add force.
alternatly you can make it a kinematic rigidbody and slowly move it yourself

that would just be a lerp from to


//script attached to cube

//physics (rigidbody enabled)
force is a speed and a direction you multiple the speed by the direction

speed = 10;
direction = vector you want to travel

force = speed * direction

//non physics
transform.position = vector3.lerp(transform.position, destination, time.deltatime)

OnCollision(collider other){
rigidbody.enable = true;
rigidbody.iskinematic = false;