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 » Scripting Helpers
Home Search
 

Moving using Velocity property and bouncing against a wall

Previous Thread :: Next Thread 
kamac is not online. kamac
Joined: 05 Dec 2008
Total Posts: 153
22 Apr 2014 04:11 PM
Hey there.

I want my object to *not* bounce off a wall, instead it should try and get through it at all costs. (So, it should keep pressing on it, concealing it's velocity)

What I have at the moment:

local floatForce = Instance.new("BodyForce")
floatForce.force = Vector3.new(0, ball:GetMass() * 196.2, 0.0)
floatForce.Parent = ball
ball.Velocity = moveDirection * 100

while wait() do
baall.Velocity = moveDirection * 100
end


And it works as intended. The only problem is that the ball, when trying to get through the wall, keeps bouncing back and forward. It's looking really jaggy. You can try it yourself with the script above.

My question is, can I make my ball move with constant velocity, physically affect other objects (like players) AND not jaggerly bounce of the wall when trying to get through it?
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
22 Apr 2014 04:13 PM
Try messing with the Elasticity of the part.
Report Abuse
kamac is not online. kamac
Joined: 05 Dec 2008
Total Posts: 153
22 Apr 2014 04:16 PM
It's the same with elasticity set to 0 and/or 1
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
22 Apr 2014 04:28 PM
I know what you mean, I have the same problem in one of my projects. The only thing is can fathom is to not apply the velocity if the parts x/z coordinate is near the wall. i.e

while wait() do
if ball.x >= wall.x then return end
ball.Velocity = moveDirection * 100
end

Of course, you'd have to factor in the wall and balls widths, but that's the jist
Report Abuse
kamac is not online. kamac
Joined: 05 Dec 2008
Total Posts: 153
22 Apr 2014 04:31 PM
It looks like Friaza somehow did it right in his Naruto Shippuden Ultimate Ninja Storm 3 game with the fireball effect. It doesn't jag like that.

Gee, I wish he, or somebody who found the solution could elaborate here.
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
22 Apr 2014 04:35 PM
BodyPosition probably wouldn't 'jag' as much
Report Abuse
kamac is not online. kamac
Joined: 05 Dec 2008
Total Posts: 153
22 Apr 2014 04:49 PM
Yeah, but BodyPosition isn't the behavior I need, because if something happens to the ball during the flight and it gets moved a bit to the right (for example), then it will also change it's velocity to reach the point. It would alter it's flight, and that's not desired here :/
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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