Exciting Physics Engine Usability Improvements!

Performance would suffer if the physics solver had to call out to luau each time it advanced a world step.

4 Likes

Great improvements! I use AlignPosition, AlignOrientation, and LinearVelocity extensively in one of my projects and these additions will improve my UX a lot. Thanks

4 Likes

Hmm this update broke my game, but the update seems good, after fixing what this update broke

2 Likes

Yeah, they should’ve migrated any AlignOrientations with the old property checked to use the new property. Was wondering why my game suddenly broke, but luckily I found the issue rather quickly.

4 Likes

Why is there still no function for onHit that returns where the object was impacted and how hard the impact was? For an engine trying to push more and more physics contraptions, this is just bizzare. Instead we’re stuck guessing whether a ‘touched’ event actually represents a hard collision or a glancing blow, or whether it was even a collision at all.
EventHit
This is Unreal Engine’s Hit Event. It tells you exact where on the assembly the impact occurred and exactly how hard the impact was. I have looked all over for how to do this in Roblox and the only solution I’ve found was to just guess based on velocity changes which is less than ideal.

8 Likes

Please look into performance improvements because of this: Disable physics throttling - #6 by McDmnks

3 Likes

Very excited for this. Would it also be possible to do this in the parallel plane? I’d like to use this for NPCs facing towards the player. First picture is what I assume the current implementation is. Second picture is what I wish to be able to do with this constraint.
NPC looking directly

Update

I messed around a bit more and it is possible to get this functionality working if combined with an additional part and 2 extra AlignPositions. Making the NPC look at a part that aligns to same height as the NPC + aligns to same X/Z as the target. Although this works it doesnt seem very stable as the NPC jitters alot. Of course ideally wouldn’t need this and could just use a single Parallel LookAt.
Parallel Look At using AlignPositions

8 Likes

Amazing update, Can’t wait for more sick updates like this!

2 Likes

@m0bsterlobster This may be causing a crash for my client in team create. Whenever I select an AlignOrientation studio now crashes:

Additionally, when my partner is setting the new properties of the align orientation, they aren’t changing physics when I test.

3 Likes

This is great actually thanks a lot! One question though: with the transition of Synapse collaborating aside Roblox now, is there any hope to seeing Network Ownership optimized soon? (Server & owner change jankiness)

4 Likes

It would also be really useful to get the force/impact the collision had. A use case would be destroying the part if it gets pushed with too much force.

3 Likes

I am almost certain this update has impacted my game, making it unplayable.

I haven’t updated the game in months, yet my noobs no longer move to their targets. I am using AlignPosition to send the noob to a certain location.

Here is the code:

Client:

events.Noobs.MoveToTarget.OnClientEvent:Connect(function(alignpositionparent, pos)
	alignpositionparent.AlignPosition.Enabled = true
	
	local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	raycastParams.CollisionGroup = "NoobsRaycastAvoidance"
	raycastParams.IgnoreWater = true
	local tabl = {}
	for i,v in pairs(noobtable) do
		table.insert(tabl, v.CreatureModel)
	end
	table.insert(tabl,player.Character)
	raycastParams.FilterDescendantsInstances = tabl
	
	local origin = alignpositionparent.CFrame
	origin = origin.p
	local direction = Vector3.new(0,-9999,0)
	local DownRay = workspace:Raycast(origin, direction, raycastParams)

	if DownRay and alignpositionparent.Position.Y - DownRay.Position.Y > 1 then
		alignpositionparent.BodyPosition.P = 1000
		alignpositionparent.BodyPosition.D = 60
		alignpositionparent.BodyPosition.Position = Vector3.new(alignpositionparent.Position.X, DownRay.Position.Y + HipHeight.Y + 0.3, alignpositionparent.Position.Z)
		alignpositionparent.BodyPosition.MaxForce = Vector3.new(0,40,0)
		
		alignpositionparent.AlignPosition.Position = Vector3.new(pos.X, DownRay.Position.Y + HipHeight.Y + 0.3, pos.Z)
	else
		alignpositionparent.BodyPosition.MaxForce = Vector3.new(0,0,0)
		
		alignpositionparent.AlignPosition.Position = Vector3.new(pos.X, alignpositionparent.AlignPosition.Position.Y, pos.Z)
	end
	
end)

Server:

	local MoveToTarget = self.StateMachine:CreateState("MoveToTarget")
	MoveToTarget.Action = function()
		coroutine.wrap(function()
		-- Error handling
		if self == nil then
			warn("SELF IS NIL")
			return
		end
		if self.AttackTarget == nil then
			warn("AttackTarget = nil")
			return
		end
		if not self.AttackTarget:FindFirstChild("HumanoidRootPart") then
			warn("No hrp in AttackTarget")
			return
		end
		
		game.ReplicatedStorage.Events.Noobs.FaceTarget:FireClient(self.Player, self.CreatureModel.HumanoidRootPart, self.AttackTarget.HumanoidRootPart)
		local cf = self:CalculateCircleCFrame()
		if (self.CreatureModel.HumanoidRootPart.Position - cf.p).Magnitude > 1 then
				local speed = NoobService:GetWalkSpeed(self.NoobStats) 
				speed += extraspeed
				self.CreatureModel.HumanoidRootPart.AlignPosition.MaxVelocity = speed
			game.ReplicatedStorage.Events.Noobs.MoveToTarget:FireClient(self.Player, self.CreatureModel.HumanoidRootPart, cf)
		
		else
			
			if self.CreatureModel.HumanoidRootPart.AlignPosition.MaxVelocity ~= 16 then
				self.CreatureModel.HumanoidRootPart.AlignPosition.MaxVelocity = 16
			end
		end
		end)()
	end

Here is where I am creating the AlignOrientation (server):

function module.LoadAlignPosition(parent)
	local alignPosition = Instance.new("AlignPosition")
	alignPosition.MaxForce = 25
	alignPosition.Responsiveness = 60
	alignPosition.MaxVelocity = 16
	alignPosition.ApplyAtCenterOfMass = true
	
	alignPosition.Name = "AlignPosition"
	alignPosition.Parent = parent

	alignPosition.Mode = "OneAttachment"
	
	local attach2 = Instance.new("Attachment")
	attach2.Parent = parent
	alignPosition.Attachment0 = attach2
end

Your post seems vague and I’m not entirely sure what changed, but my issues seemed to pop up the same time of this update. Could you provide any insight to help me debug this issue?

4 Likes

How did you resolve your broken game? Am having issues too.

In fact, the past two physics updates broke what I have been working on. These occurrences are not fun to deal with. Last time I fixed it by changing my hz to “fixed” and upping the hz, this time, not so sure.

2 Likes

Hello! I’m late to the party, but nevertheless I’d like to request a similar vector max-torque property for AlignOrientation, rather than the scalar property we have now.

Currently, I’m extremely confused as to how to use AlignOrientations; even after scouring through wikis for an hour, I have no clue how to use these properties! I want to implement an anti-tipping force to make sure my models don’t fall onto the ground, whilst retaining freedom of movement on the other rotational axes. I’m not sure if this is possible - and if it is, the overly-complicated API makes it extremely hard to figure out.

I don’t consider myself good at physics, but I’m 18 and have been on this platform for half a decade! It makes me quite worried as to how kids will figure this out - if at all. A simplification to the API would be heavily appreciated, as I’m stumped for how to implement what I want :sweat_smile:

2 Likes

Why was the default property changed for all AlignOrientations in existence? This is going to break a lot of games that relied on the old default AlignType properties. Happened to our bike system in Robloxian High School which relied on the old defaults, as can be seen in the following video.

3 Likes

Hey Usering, apologies for the troubles. How is the AlignOrientaion being configured on your motorcycle? The default AlignType (AllAxes) should behave identically to existing behavior. Can you send me the model of the motorcycle you are using? We would be interested in taking a look at your specific use case and see if we can help.

Sure I’ll DM you the model. The fix here was setting AlignType to PrimaryAxisParallel though

Hi fkonsk!

Could you please DM me the file to be able to reproduce this. I will pass it along to the rest of the team to try to get this fixed!

Best,
M0bsterlobster

1 Like

What do you mean by planetary gravity? Could you please explain what you’re hoping to achieve :slight_smile:

To put it simply: Super Mario Galaxy physics. The ability to walk on walls and switch the direction of gravity. Kind of like EgoMoose’s character controller.
Video demonstration: