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: Downward direction help

Previous Thread :: Next Thread 
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
27 Dec 2015 09:36 PM
How would I determine a player's downward direction? For example, when a player gets rotated sideways, I want a script that determines what direction is down. Can anyone help?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Dec 2015 09:41 PM
local downDir = torso.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0));
That'll be "his down"

The "real down" is just Vector3.new(0, -1, 0);
Report Abuse
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
27 Dec 2015 10:05 PM
Thanks, but can I use it in place of vector3?

part.Velocity = Vector3.new(0, -1, 0)

to

part.Velocity = torso.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0))
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Dec 2015 10:07 PM
yeah
Report Abuse
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
27 Dec 2015 10:17 PM
Thank you! You are an amazing scripter!
Report Abuse
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
28 Dec 2015 04:16 PM
I also need my weapon to work when the player is turned, but Roblox velocity always turns the bullet around and makes it go to the real down. How would I make the bullet go to the "new" down?

P.S. I am testing it with Roblox's paintball gun, so if you want you can test it too
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Dec 2015 04:59 PM
Cancel out the acceleration due to gravity:
Instance.new("BodyForce", part).force = Vector3.new(0, part:GetMass() * 196.2, 0)

And it won't affect it. If you want gravity to be applied to the new 'down', do what I did above but set the force to the down direction (and multiply by 196.2 * mass)

so like
.force = downDir * part:GetMass() * 196.2
Report Abuse
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
28 Dec 2015 05:30 PM
When I shoot it, it goes down in the right direction, but it just goes straight down. I need it to make an arc and fall faster based on how high I shoot it.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Dec 2015 05:31 PM
It already will.

You want the bullet to shoot in the downward direction and emulate gravity on its down direction and ignore the "real" gravity, right?
Report Abuse
walkman057 is not online. walkman057
Joined: 02 Dec 2014
Total Posts: 250
28 Dec 2015 06:29 PM
I don't want it to go straight down right away, I need it to make an arc by going up first and then fall down.
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