#Issues with BodyPositions

50 messages · Page 1 of 1 (latest)

jolly gate
#

I'm working on a game that has a system where you swap between 2d and 3d status, when going back into 2d, the body position properties wont change and you arent locked back into 2d properly.

the script is a LocalScript and in StarterCharacterScripts

    task.wait(0.1)
    script.Perspective.Value = not script.Perspective.Value
    
    local cam = workspace.Camera

    local char = script.Parent
    local hrp = char.HumanoidRootPart
    task.wait()
    
    local Positioner = hrp.BodyPosition
    Positioner.MaxForce = Vector3.new(0, 0, 1e10)
    Positioner.Position = Vector3.new(0, 0, 2)
    print(Positioner.MaxForce)
    print(Positioner.Position)
    
    game:GetService("RunService").RenderStepped:Connect(function()
        if script.Perspective.Value == true then
            cam.CameraType = Enum.CameraType.Scriptable

            cam.CFrame = cam.CFrame:Lerp(CFrame.new(hrp.Position + Vector3.new(0, 5, 35), hrp.Position), 0.1)
        else
            return
        end
    end)
end```
ashen spearBOT
#

studio** You are now Level 1! **studio

heavy merlin
#

are u using vector force

#

for orienting the body?

#

use AlignOrientation instead

#

also thats a really cool game idea

#

2d/3d swapping

#

good luck with it

jolly gate
jolly gate
#

ty :D

heavy merlin
#

maybe lock the humanoid root part onto a prismatic constraint via a script

#

thats more effective

jolly gate
#

hm?

heavy merlin
#

yea that should work

jolly gate
#

sry im new to scripting

heavy merlin
#

hold up

jolly gate
#

uhm

#

it says it locks rotation on the forum

ashen spearBOT
#

studio** You are now Level 2! **studio

heavy merlin
#

PrismaticConstraint allows two attachments to slide along one axis but not rotate, with optional assigned power for mechanisms like sliding doors and elevator platforms.

Constraint which creates a rigid joint between two
Class.Attachment|Attachments, allowing them to slide along one axis but not
rotate.

#

then

#

so if u want it to rotate

jolly gate
#

i think cylindricalcontraints could work

#

so it can rotate along the y axis (i think its the one that can spin you) and move along the x axis or z axis

#

lemme check smth rq

#

so i would need to move the z axis, and rotate along the y axis

#

thats possible with the cylindrical constraint correct?

#

wait

#

if im just trying to make this rotate my character and let me move along an axis

#

then what would the second part be attached to?

heavy merlin
#

idk, baseplate? Ground? Just make an invisible part to anchor it?

jolly gate
#

so

#

a cylindrical constraint only moves up and down and rotates

#

usually used for wheel suspension

#

i could check if the player is moving left or right and then change their model rotation

#

i've checked every weld from the documentation, but you cant jump, rotate, and move alone one axis at the same time

#

bodyposition is the only thing i know of as of now

#

i think i might have found the issue one second

#

i got it working

#

it was the keybind toggle system i had

#

it wasnt fully changing the values

jolly gate
#

issue was fixed

jolly gate
#

no