I am trying to set a part to a height that’s constantly changing slightly due to it being the height of water, but it doesn’t apply the force when the game first runs, and it seems to bounce a lot and go back to it’s original position once it reaches its target position. It eventually settles and stops bouncing if I set the Y to a constant value, but it still takes a while to get there. I really want the height to be updated constantly, so it would be very helpful to not have it bounce around.
I really want to just set the position of the part, since I want to expand this system to work with boats, and I don’t really want to have to code CFrame boats.
Currently my values for the bodyposition are:
P = 10000
D = .99 (i was trying to see if this would do anything)
MaxForce = Vector3.new(10000, 10000, 10000)
although I don’t believe the X and Z value change much, if at all.
Any help would be appreciated, really not sure how I would stop this bouncing.
I’m trying to use BodyPosition and BodyGyro for something similar, but nothing happens to the part. It’s unanchored, massless (although that doesn’t seem to change anything), welded to the rest of the model using qPerfectionWeld, is the primary part of the model, and it still just does nothing. I have no idea what to do with it, and I’ve never touched the newer versions of bodyposition and bodygyro.
why not try using tweenservice to move the objects. if you need players to be carried with it, raycast downwards to see if they are above a moving part, and offset the characters cframe position by the amount that the object is moving
It would work, but as I said in the post, I would like to expand it to work with boats, which from what I’ve found isn’t easy to code with CFrame. Tweening would only really work for single parts floating, which there won’t be many of, if there are any at all. I’m not sure about the raycasting either, seems like a lot of work, and a bit inefficient.
I managed to get the BodyPositions to work, although the ruberbanding issue is still there. Not sure how to fix it. After messing with the values, I can’t find a point where it keeps up with the changing values, but doesn’t rubberband.
At this point I’m using 1 body position that samples the height of water at the centre of the boat, and a body gyro that angles the boat. The body gyro doesn’t angle it properly though, but I no longer have any elasticity, which I guess is good.
arent both of these Instances deprecated? newer versions AlignPosition and AlignOrientation may solve your elasticity issue.
as to the message i replied to, tweening is actually pretty simple with multiple parts, because once welded together (with WeldConstraint) which I assume you likely have already done, any parts tweened in the boat will move the rest of the parts welded to it! though obviously i understand if you wont use this method due to it being kinda complicated to manipulate the tween goal cframe to be afloat using raycasts, like you said
They are both deprecated, but the newer ones seem a lot more complex. The tweening could work, I do have the entire model welded together, although I would have to spend a bit of time figuring out the movement. Another issue is that I’d also like to implement some sort of wind system that pushes the boat around, and I’m not entirely sure how I’d do that with tweens, I assume it would probably involve just having a bunch of vectors and just adding them together to get the final speed and direction.
i havent actually looked into these older physics constraints but these modern ones are actually pretty simple to understand, from what im getting you would only need to change their AlignmentMode to OneAttachment and then feed your CFrame into there.
tweening on the other hand seems alot more easier from what im seeing too though, as you would only need to place a single CFrame into a property to move the whole boat, and you seemingly already have the goal boat orientation and position calculated!
as for the wind, i agree, i think it would just be adding windeffect value to a velocity value, that you add to this position CFrame per Heartbeat, and you could have a realistic detection on if the boat is perpendicular to the wind by using Vector3:Dot() which would be pretty cool too
I’ll definitely have a look at tweening, I still haven’t even started on the movement yet since I’ve been too focused on getting the buoyancy perfect. The wind seems like a really cool idea though, especially if I can implement it right. might have to change my script layout a bit though, not sure how easily i’d be able to implement movement in. once again i have no idea how Vector3:Dot() works, but i’m sure it wouldn’t take too much to get it to move with or against the wind.
One question I do have though, is that if I tween the boat, can i have it anchored? and would the player move with it? ive only ever tweened guis, so i dont know much about part tweening.
yes, whenever you tween movement for something, it needs to be anchored or it will just fall lol, but you raise a good point, i’m pretty sure tweened instances dont actually apply physical forces other than collisions… A workaround for this however is to use a physical constraint to apply these forces instead which will make the player move along with the boat, and you could have a part being tweened, and then use “RigidityEnabled” to make the boat forcefully follow it which will almost certainly have no elasticity as it applies infinite force to move its targets.
it would look like this, with a non collide, query and touch part anchored to move around with tweens, while the boat model is dragged along (unanchored) with the align position and orientation constraints.
here are what the physics constraint properties would more or less be like, by the way: