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: Halp! Need to use BodyForce along Object Space!

Previous Thread :: Next Thread 
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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
TheRevengeOfRay is not online. TheRevengeOfRay
Joined: 20 Apr 2014
Total Posts: 54
02 Dec 2015 07:18 PM
BodyForce.Force = projectile.CFrame.lookVector*100
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
02 Dec 2015 07:26 PM
@Ray

Ty for this, I'm having so much fun right now :D
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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 is not online. 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
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
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
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