For developers who are trying to work with hardcore simulation effects, such as dealing with a virtual vehicle suspension system, plane aerodynamics and physics, building / architecture physics simulation, and physics-based engineering simulations, knowing information regarding mass and momentum is critical.
This post suggests methods that could be used to get such information from an assembly efficiently, without requiring developers to use intensive and complex physics calculations to be able to deduce.
-
Get Assembly Load
e.g.
assembly.AssemblyLoad: number
– The load represents the weight of the assembly: the force it exerts onto the ground due to gravity.
– It can be used to push objects against the weight of gravity, or also to calculate the force such an object would exert when resting on the ground or another object. -
Get Assembly Load Positionally
e.g.
assembly:GetLoadAtPosition(position: Vector3): Vector3
– The weight force of the assembly at that position.
– The positional component allows rotational momentum to have an affect on the assembly’s load.
– This value changes based on the state of the object, i.e. a vehicle with a heavy engine will have a larger forward load force.
– This is very important when handling plane aerodynamics, and tire load on a moving ground vehicle.
– Another example is a braking ground vehicle will exert a heavier load force in the direction of movement as the vehicle tilts/pitches from the wheels’ braking forces. -
Get Assembly Momentum
e.g.
assembly.AssemblyMomentum: number
– The current momentum of the assembly.
– This is a component influenced by the mass of the assembly, and its velocity.
– Can be used in equations to apply forces between multiple interacting objects. -
Get Assembly Momentum Positionally
e.g.
assembly:GetMomentumAtPosition(position: Vector3): Vector3
– The momentum of the assembly at that position.
– This allows the inclusion of rotational momentum as applied at that position.
– If handling components such as constraints or complex object interaction, this will allow for proper momentum distribution and application across objects. -
Get Assembly Mass Positionally
e.g.
assembly:GetMassAtPosition(position: Vector3): number
– Returns the mass of the assembly when sampled from that location
– As an assembly’s mass is a complex combination of the mass of all of its parts, a positional offset represents a mass sampled away from the center of mass, as if sampled on a scale from an arbitrary point on the object
– Useful when computing information such as stress, tension, or load distribution across a model -
Assembly Tension/Stress Information
e.g.
assembly:GetTension/StressAtPoint(point: Vector3): number
– Computes the tension or stress applied at that particular point in the assembly.
– Very useful when dealing with complex assemblies such as buildings or planes, and being able to snap off or break objects when under too much stress.
– This tension can include any forces acting on the object, such as the load/gravity of the assembly’s parts and anything resting on top of the assembly, as well as forces pressing down, against, or toward the assembly, such as a hydraulic press or a car’s weight on a wheel on a spring.
– Constraints and usage ofApplyImpulse
will be able to affect the tension property as well as all others, i.e. springs that pull on the object from both sides, or applying the same impulse on two opposite sides of the assembly, and a negative impulse in the center. -
Assembly Point Intersection
e.g.
assembly:GetPartAtPoint(point: Vector3): BasePart?
orassembly:IntersectsPoint(point: Vector3): boolean
– Either returns the part (if any) that contains that point, or returns if the point is part of the assembly.
– Useful when computing the stress across a large assembly, as points which are not part of the assembly can be ignored completely.