generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: lookVector difficulties

Previous Thread :: Next Thread 
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 09:43 PM
So I'm doing this for the first time, and it's kind of weird imo. I'm trying to figure out how I can make a player launch forwards or backwards with bodyforce, does anybody have a clue how I can do this?


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
KaminaLagann is not online. KaminaLagann
Joined: 16 Jul 2016
Total Posts: 222
07 Feb 2017 09:44 PM
Try using bodyVelocity
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
07 Feb 2017 09:47 PM
if it is a force local to the current direction

Vector3.new(x,y,-z)

if it is global (world space)

myCFrame:vectorToWorldSpace( Vector3.new(x,y,-z) ) --lookvector shifted locally by x,y,-z
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 09:49 PM
Help me please, I just want to know how to use lookvector correctly so I can make a knockback work.


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 09:52 PM
You guys are confusing me all I'm trying to ask for is a way to make lookVector go backwards, so I can use a knockback script like this;

local bv = Instance.new("BodyVelocity")
bv.P = 5000
bv.Velocity = Vector3.new(0,0,15)
bv.MaxForce = Vector3.new(4000,4000,4000)
bv.Parent = hit.Parent.Torso

the problem with this is that itll only go on the Z axis, meaning it needs to go directly behind where the torso is positioned. How can I do this?


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
07 Feb 2017 09:53 PM
'way to make lookVector go backwards'

are you serious lmao

-force

or

-lookVector
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
07 Feb 2017 09:54 PM
also if you did not know this, lookvector is just a vector 1 stud in the direction in front of the cframe, so multiply it to get a stronger force

also definitely multiply by Vector3.new(1,0,1) so people don't do things like get knocked back into space unless it is from their own gun or something
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 09:55 PM
I'm using a bodyforce, and I want it to give the player a knockback effect. Isn't it true that you have to use lookVector to knock the player backwards?


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 09:56 PM
Wunder I know that you can multiply it, I just need an example of how to do it using a bodyforce. help me please.


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
07 Feb 2017 09:56 PM
it isn't really a fact, it is just math

since force is global then you have to apply a local -> global force
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
07 Feb 2017 09:59 PM
if i remember it was something to do with lookVector and changing the velocity of the player's torso
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 10:01 PM
@XCVlll I know about this, but the problem is it doesn't even do it the way I want it to.

local bv = Instance.new("BodyVelocity")
bv.P = 5000
bv.Velocity = script.Parent.CFrame.lookVector * 30
bv.MaxForce = Vector3.new(4000,4000,4000)
bv.Parent = hit.Parent.Torso

Maybe I should try;


local bv = Instance.new("BodyVelocity")
bv.P = 5000
bv.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * 30
bv.MaxForce = Vector3.new(4000,4000,4000)
bv.Parent = hit.Parent.Torso


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
07 Feb 2017 10:03 PM
Works now, thanks for the help btw.


Tips are always good | https://www.roblox.com/catalog/588125527/Tip
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image