I want the cannon ball to go front but it is fixed in a position and when I push it , it moves in that direction

Hello there.
So here is what happens when the trigger is ended:
https://gyazo.com/5f9884aefbd0936fbcc01801b38c2c2d
So as you saw the fireball gets fixed in a position and then when I push it, it goes in the direction I pushed.
But my aim is to make it move forward in as the trigger ends like a cannonball
What requirements do I need to achieve that certain result?

Have you considered using a prismatic constraint?

Or setting the AssemblyLinearVelocity?

Maybe try setting the Velocity to somthing like this

CannonBall.AssemblyLinearVelocity = CannonBarrel.CFrame.LookVector * 10
1 Like

Thanks!
I set the AssemblyLinearVelocity to the RightVector of the cannonball itself and multiplied it by 100
and it works fine.
I am interested to learn more about Velocity and vectors to understand the concept to come up with the solution myself!
If you can provide any other helpful info that would be deeply appreciated.
Question: Why are we multiplying it and what does it really change? (does it change the speed?)
Outcome:
https://gyazo.com/2ddfb0c25ea06c31cd61b827e6d1385a

1 Like

Sure!

Yes. You need to understand that Velocity and Speed are not the same. Speed is a number(scaler) and Velocity is a Vector.
To create a Vector we need 2 things.

  • A Direction/Unit Vector
  • A Distance/Speed/Scalar/Magnitude

We can get the Direction of a part face direction by doing the CFrame.LookVector it returns a direction for us.

We can make up a speed of what we would like the part to travel at e.g. 10 or 5.

If you would like to know more about vectors there is a website called GeoGebra
I have some pics of a 2d Vectors so you can visualize it too.
here is a pic of VectorA(1,1)
Vector1,1
Here is a picture of VectorB(1,1) and VectorC(-2,-1)
Vector-2,1
This here is a demonstration of VectorC(3,3) and VectorB(5,1)Vectors

The magnitude/scalar is the length of the Vector. If you know trigonometry you will even be able to calculate the length of these lines by doing
Cx^2 + Cy^2 = Length of C

Finally a unit vector or direction always has a length of 1 when you do CFrame.LookVector.Magnitude you will always get 1.

Hope this isn’t too hard :smiley:

1 Like

Yes, thank you for the help and it wasn’t too hard to understand :slight_smile: