|
| 02 Dec 2015 07:14 PM |
I've been trying to get this right for two hours now. I want to use BodyForce to move a projectile from a turret towards a "target". I got my projectile's rotation to match the barrel's rotation along creation. I tried to apply force to the velocity using BodyForce, but it goes off of World Space, so the projectile always moved in one direction, regardless of it's rotation. BodyThrust uses Object Space, which is what I want, but it doesn't move at a constant rate - It slowly speeds up. I want it to move at a constant rate using object space. What do I do?
-SonyController, Up-And-Coming LUA/Unity Dev |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 07:18 PM |
| BodyForce.Force = projectile.CFrame.lookVector*100 |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 07:26 PM |
@Ray
Ty for this, I'm having so much fun right now :D |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 07:44 PM |
@Ray That was unsuccessful. This may have been due to a lack of explanation on my part though - I had set the Y force to (196.2 * projectile:GetMass()) in order to counteract gravity.
-SonyController, Up-And-Coming LUA/Unity Dev |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 07:56 PM |
I was looking around the wiki and found :ToObjectSpace(), but I have no idea if that fits the situation or how to properly apply it.
-SonyController, Up-And-Coming LUA/Unity Dev |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 08:08 PM |
Oh wait! @Ray your method ALMOST works! I changed it from BodyForce to BodyVelocity. It moves the way I want it to, except it moves along the X axis; It goes out left of the barrel, instead of straight out. It's moving along the wrong axis. Any fix?
-SonyController, Up-And-Coming LUA/Unity Dev |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 08:22 PM |
Still need help. The solution is right there, I can taste it!
-SonyController, Up-And-Coming ROBLOX/Unity Dev |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 02 Dec 2015 08:30 PM |
That doesn't move along the X axis, it will move in the direction of the front surface of the object. You _need_ the X axis.
BodyVelocity.velocity = part.CFrame:vectorToWorldSpace(Vector3.new(1,0,0)) * 100 |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2015 08:32 PM |
Heyo! It worked! Just had to make it -1. Thanks for the help! :D
-SonyController, Up-And-Coming LUA/Unity Dev |
|
|
| Report Abuse |
|
|