doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 13 Dec 2012 01:12 PM |
So not increasing the walkspeed, but add velocity in the direction the character's camera is facing. I can't up the walkspeed because I have BodyVelocity on the character and it's too strong for the character to move, so I need to create "artificial" movement.
Thanks! |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 01:17 PM |
well you can get the camera direction by running this in a local script
facingCFrame = game.Workspace.CurrentCamera.CoordinateFrame.lookVector |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 13 Dec 2012 01:27 PM |
hm how can I make a create a spawn a local script with that info in it?
|
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 13 Dec 2012 01:28 PM |
| I have a script that acts onTouch and I need this to be in the same script. |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 01:30 PM |
The only way I can see you accessing the camera's direction after a touch event is to make a script inside of the touchscript that you then clone into the player, e.g.
script.Parent.Touched:connect(function(hit) if hit.Parent["Humanoid"] then s = script.WalkScript:clone() s.Parent = game.Players:GetPlayerFromCharacter(hit.Parent) end end)
|
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 13 Dec 2012 01:47 PM |
| Thats a great idea! Thanks. Now I just need to add velocity in a certain direction... |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 01:51 PM |
Yeah, that I am not too sure about, however I believe that if you add a .Unit onto the end of the lookVector, then add the following:
power = 10 --Change to the velocity you want in the direction they are heading x = facingCFrame.X*power y = facingCFrame.X*power z = facingCFrame.X*power BodyVelocity.velocity = Vector3.new(x,y,z) --Make sure to allocate BodyVelocity
I am not overly confident, but give it a try |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 13 Dec 2012 01:54 PM |
| I'm going to try it without the y because I don't want him to fly away. I'll try it out in a couple of minutes. |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 01:56 PM |
| oh okay, just switch y with 0. |
|
|
| Report Abuse |
|
|