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: Help with position based on distance

Previous Thread :: Next Thread 
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
19 Apr 2016 04:21 PM
local mag = (v.Position - workspace[game.Players.LocalPlayer.Name]:FindFirstChild("Torso").Position).magnitude
sizeFactor = math.floor(mag)
v.CFrame = CFrame.new(walls[v][1].X,0,walls[v][1].z)

how can I make v go higher when closer, smaller when further away?

putting sizefactor in the y value works, but the parts are shaky

"Well someone has to stay to the end, sir"
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
19 Apr 2016 06:13 PM
Oi, lol been a while since verlet.

You should save the old position of the wall before you apply the size and then position it back to the old position with cframe


Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
19 Apr 2016 06:16 PM
Oops, the shaky might be from your character's torso breathing animation. You should use the HumanoidRootPart for the magnitude check then.


Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 01:43 AM
this isn't verlet btw

"Well someone has to stay to the end, sir"
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
20 Apr 2016 01:45 AM
I don't see how that's verlet at all...

"how can I make v go higher when closer, smaller when further away?"
Well assuming you want it linear, you could do something like:

v = math.max(0, maxV - mag) or something
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 01:54 AM
play trioxides walls of granite
https://www.roblox.com/games/248831969/Walls-of-Granite

that's what I'm trying to create. I've changed my script to this, currently:

local mag = (v.Position - workspace[game.Players.LocalPlayer.Name]:FindFirstChild("HumanoidRootPart").Position).magnitude
sizeFactor = math.floor(mag)
v.CFrame = walls[v][1]*CFrame.new(0,-sizeFactor+(walls[v][1].Y+v.Size.Y/10),0)

this works fine but there's a problem:
jumping makes them go down


"Well someone has to stay to the end, sir"
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 03:13 AM
b
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 10:48 AM
b

"Well someone has to stay to the end, sir"
Report Abuse
TigreBlood is not online. TigreBlood
Joined: 31 Jul 2011
Total Posts: 1107
20 Apr 2016 11:18 AM
To start, clean up your code.
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 11:28 AM
why are the pseudo trolls back

"Well someone has to stay to the end, sir"
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
20 Apr 2016 11:43 AM
maybe if they jump you do the opposite in the code so it goes up instead of down

idk man


#Code print("Narwhals are our future")
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
20 Apr 2016 12:10 PM
n

"Well someone has to stay to the end, sir"
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
20 Apr 2016 09:06 PM
I'm just saying it's been a while since i've spoken to you on the verlet post


Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
20 Apr 2016 09:08 PM
Don't take the y value of the humanoid root part's position...

do
local HRP = Character.HumanoidRootPart
local OffsetFromTheFloor = 3 -- Distance from feet to center of the rootpart/torso
local NewPos = CFrame(HumanoidRootPart.x,OffsetFromTheFloor,HumanoidRootPart.z)


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