I’m interested, show me the game
here it is
let me know when you join so i can show you
K its getting late so youll have to play on ur own.
To trigger the event walk on the planks close to where you spawn.
I need to correct myself when i said i just made the force small to keep players from floating. This was not how i programmed it. I use a body force but i multiple the Force property with Vector3.new(1,0,1) so like this
bF.Force = bF.Force * Vector3.new(1,0,1).
This cancels any upward force incase the LookVector is pointing up
Personally I wouldn’t roll the ball as you can’t really control acceleration and direction change all that well. The ball might start sliding if you add too much angular velocity.
So, I recommend switching to LinearVelocity. There you can change the MaxForce(maximum acceleration) and Responsiveness(Maximum jerk) and you can directly control the balls Velocity directly. Also, you can set the balls Friction to something high too that will make it roll
Sorry for very late response, I played the game though not quite what I’m looking for
How would I go about setting it up so the player can move around with LinearVelocity? I don’t really know how to do this
LinearVelocity is a constraint. Constraints need attachments.
So to start of you need an attachment. You don’t have to create a new one (If the balls network ownership is owned by the client that is) you can just take one of the attachments that are in the Body of the character e.g. RootRigAttachment
Then setup the LinearVelocity. You can create it via script then parent it to the ball. Keep a reference of the LinearVelocity. Make sure the Relative to is set to world as the attachment will be spinning around.
MaxForce is Maximum Acceleration. A higher value and the velocity will be quicker to reach the target.
Responsiveness is Maximum Jerk. It represents how fast the acceleration can be applied.
The rest is just the same as BodyVelocity. But instead with LinearVelocity.
LinearVelocity also provides some extra features that BodyVelocity does not. VelocityConstraintMode allows us to only apply forces in a specific direction. For example maybe we only want the Ball to move along the ground. For that you need to set it to Enum.VelocityConstraintMode.Plane
The Primary axis and Secondary axis are simply (1,0,0) and (0,0,1) note: you can see that we don’t want to apply the force in the Y Axis.
Then we can finally start rolling the ball. We can get the RelativeForward d ddairection of the Camera by doing this.
local Forward = CFrame.Camera.LookVector * Vector3.new(1,0,1) -- Flatten
Forward = Forward.Unit -- Normalize
Then you can map your Vector3 to the Vector2 plane ignoring the Y value.
Vector2.new(Vector3.X,Vector3.Z) -- Like this
Change the Plane velocity to that Vector and voila! It should move.
Thank you! I will try this when I wake up
Again, sorry for late respone, this is what my ball script looks like following your suggestion:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local HRP = char:WaitForChild("HumanoidRootPart")
local marble = Instance.new("Part")
marble.Size = Vector3.new(8,8,8)
marble.BrickColor = BrickColor.Random()
marble.Transparency = .5
marble.Shape = Enum.PartType.Ball
marble.Parent = char
marble.Material = Enum.Material.SmoothPlastic
marble.Name = "Sphere"
local Velocity = Instance.new("LinearVelocity")
local Att = Instance.new("Attachment")
Velocity.Parent = marble
local Hum = char:WaitForChild("Humanoid")
local Weld = Instance.new("Weld")
Weld.Parent = marble
Weld.Part0 = HRP
Weld.Part1 = marble
Att.Parent = marble
Hum.PlatformStand = true
local JumpScript = script.Effect:Clone()
JumpScript.Disabled = false
JumpScript.Parent = HRP.Parent
marble.LinearVelocity.LineDirection = Vector3.new(0,0,0)
local Forward = CFrame.Camera.LookVector * Vector3.new(1,0,1) -- Flatten
Forward = Forward.Unit -- Normalize
Velocity.LineVelocity = 100
Velocity.LineDirection = Vector3.new(char.Humanoid.MoveDirection.z * 20,0,char.Humanoid.MoveDirection.x * 20)
Velocity.MaxForce = 1000
Velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Plane
Velocity.Attachment0 = marble.Attachment
Velocity.Responsiveness = 100
Velocity.PrimaryTangentAxis = Vector3.new(2,0,0)
Velocity.SecondaryTangentAxis = Vector3.new(0,0,2)
Velocity.PlaneVelocity = Vector2.new(Vector3.X,Vector3.Z)
end)
end)
It comes up with an error saying responsiveness isn’t a varaiable and even without it I can’t move my ball
Sorry my bad must have Got mixed up my constraint properties.
Just remove the line with responsiveness.
If you are using plane the you don’t really need the Line Velocity or Line Direction
It now says 'attempt to index nil with ‘look vector’
… I must have been sleeping when I wrote that reply lol…
Camera and Cframe are the wrong way round
there’s a red underline beneath camera, is it the same as currentcamera with (game.workspace.currentcamera) or no?
Yeah. I usually store it like this at the start of my scripts
local Camera = workspace.CurrentCamera
You may want to try and add more force to the ball.
Still nothing, I set it above 1m
Use TweenService or Body Movers
I think this is what I’m missing, how would I do this in scripts?
RootRigAttachment is located in the LowerTorso.
LinearVelocity applies the force to the attachment position. So, it it isn’t in the center you may want to create a new attachment instead.