007n7
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 109 |
|
|
| 25 Apr 2014 08:57 PM |
Hi, I'm trying to make a ball that you can control with a hopperbin. I'm trying to make it go forwards in the direction that the camera is facing. I already have the keydown event and camera attached. I also have it so it rotates in the direction that the camera is facing, but I need to know how to make it go forward. I tried using angularvelocity and it went in the same direction no matter what. Please help! |
|
|
| Report Abuse |
|
|
007n7
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 109 |
|
| |
|
|
| 25 Apr 2014 09:10 PM |
Camera.CoordinateFrame.lookVector
and I wouldn't use bodyangularvelocity because then your ball won't be able to roll. |
|
|
| Report Abuse |
|
|
007n7
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 109 |
|
|
| 25 Apr 2014 09:13 PM |
What should I set as lookVector? Also, what kind of velocity should I use, I tried BodyVelocity and it did the same thing.
Here's my script:
while true do wait() if script.Parent.up.Value == true then script.Parent.BodyAngularVelocity.angularvelocity = Vector3.new(0,0,script.Parent.BodyAngularVelocity.angularvelocity.Z+1) elseif script.Parent.up.Value == false and script.Parent.BodyAngularVelocity.angularvelocity.Z > 0 then script.Parent.BodyAngularVelocity.angularvelocity = Vector3.new(0,0,script.Parent.BodyAngularVelocity.angularvelocity.Z-1) end local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = game.Workspace.CurrentCamera.CoordinateFrame:components() heading = math.atan2(m02, m22) script.Parent.Rotation = Vector3.new(0,math.deg(heading),0) end
|
|
|
| Report Abuse |
|
|
|
| 25 Apr 2014 09:13 PM |
bodyvelocity.velocity = camera.CFrame.lookVector*speedhere
speedhere would be like,20 |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 25 Apr 2014 09:14 PM |
Extracting euler's angle from the camera sucks.
Just. Don't. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2014 09:17 PM |
| Like I said, BodyAngularVelocity rotates islandmaker. Plus even if it didn't, yours would make the ball fly in the air. |
|
|
| Report Abuse |
|
|
007n7
|
  |
| Joined: 13 Oct 2008 |
| Total Posts: 109 |
|
|
| 25 Apr 2014 09:18 PM |
Got it to work. Thanks everyone for helping! (just incase someone looks this up or something heres the script i used:) while true do wait() if script.Parent.up.Value == true then script.Parent.BodyThrust.force = Vector3.new(0,0,script.Parent.BodyThrust.force.Z-100) script.Parent.BodyThrust.location = game.Workspace.CurrentCamera.CoordinateFrame.lookVector elseif script.Parent.up.Value == false and script.Parent.BodyThrust.force.Z > 0 then script.Parent.BodyThrust.force = Vector3.new(0,0,script.Parent.BodyThrust.force.Z+100) script.Parent.BodyThrust.location = game.Workspace.CurrentCamera.CoordinateFrame.lookVector end local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = game.Workspace.CurrentCamera.CoordinateFrame:components() heading = math.atan2(m02, m22) script.Parent.Rotation = Vector3.new(0,math.deg(heading),0) end
|
|
|
| Report Abuse |
|
|
|
| 25 Apr 2014 09:19 PM |
| I have no idea how that even worked but okay. |
|
|
| Report Abuse |
|
|