Jolt Patch

This commit is contained in:
2026-07-09 17:25:48 -07:00
parent cb19c9b5b4
commit 9d83c318b6
18 changed files with 2542 additions and 157 deletions

View File

@ -158,7 +158,9 @@ extern class Body {
public function IsSensor():Bool;
public function SetIsSensor(sensor:Bool):Void;
public function GetPosition():RVec3;
public function GetPositionInto(out:RVec3):Void;
public function GetRotation():Quat;
public function GetRotationInto(out:Quat):Void;
public function GetWorldTransform():Mat44;
public function GetCenterOfMassPosition():RVec3;
public function GetCenterOfMassTransform():Mat44;
@ -291,6 +293,7 @@ extern class MassProperties {
@:native('Jolt.BodyCreationSettings')
extern class BodyCreationSettings {
public function new(shape:Shape, position:RVec3, rotation:Quat, motionType:Int, objectLayer:Int):Void;
public var mObjectLayer:Int;
public var mFriction:Float;
public var mRestitution:Float;
public var mLinearDamping:Float;
@ -409,9 +412,70 @@ extern class ObjectLayerPairFilter {
public function new():Void;
}
@:native('Jolt.RayCastSettings')
extern class RayCastSettings {
public function new():Void;
}
@:native('Jolt.BroadPhaseLayerFilter')
extern class BroadPhaseLayerFilter {
public function new():Void;
}
@:native('Jolt.ObjectLayerFilter')
extern class ObjectLayerFilter {
public function new():Void;
}
@:native('Jolt.DefaultObjectLayerFilter')
extern class DefaultObjectLayerFilter extends ObjectLayerFilter {
public function new(objectLayerPairFilter:ObjectLayerPairFilter, objectLayer:Int):Void;
}
@:native('Jolt.BodyFilter')
extern class BodyFilter {
public function new():Void;
}
@:native('Jolt.ShapeFilter')
extern class ShapeFilter {
public function new():Void;
}
@:native('Jolt.CastRayCollector')
extern class CastRayCollector {
public function new():Void;
public function Reset():Void;
public function SetContext(context:Dynamic):Void;
public function GetContext():Dynamic;
public function UpdateEarlyOutFraction(fraction:Float):Void;
public function ResetEarlyOutFraction(fraction:Float = 1.0):Void;
public function ForceEarlyOut():Void;
public function ShouldEarlyOut():Bool;
public function GetEarlyOutFraction():Float;
public function GetPositiveEarlyOutFraction():Float;
}
@:native('Jolt.CastRayClosestHitCollisionCollector')
extern class CastRayClosestHitCollisionCollector extends CastRayCollector {
public function new():Void;
public function HadHit():Bool;
public var mHit:RayCastResult;
}
@:native('Jolt.BroadPhaseQuery')
extern class BroadPhaseQuery {
public function CastRay(ray:RRayCast, result:RayCastResult,
broadPhaseFilter:BroadPhaseLayerFilter,
objectLayerFilter:ObjectLayerFilter):Void;
}
@:native('Jolt.NarrowPhaseQuery')
extern class NarrowPhaseQuery {
public function CastRay(ray:RRayCast, result:RayCastResult):Bool;
public function CastRay(ray:RRayCast, settings:RayCastSettings,
collector:CastRayCollector, broadPhaseFilter:BroadPhaseLayerFilter,
objectLayerFilter:ObjectLayerFilter, bodyFilter:BodyFilter,
shapeFilter:ShapeFilter):Void;
}
@:native('Jolt.ContactListenerJS')
@ -440,6 +504,7 @@ extern class PhysicsSystem {
public function SetContactListener(listener:ContactListener):Void;
public function SetBodyActivationListener(listener:BodyActivationListener):Void;
public function GetNarrowPhaseQuery():NarrowPhaseQuery;
public function GetBroadPhaseQuery():BroadPhaseQuery;
public function AddConstraint(constraint:Constraint):Void;
public function RemoveConstraint(constraint:Constraint):Void;
}

View File

@ -156,7 +156,9 @@ interface Body {
int GetMotionType();
void SetMotionType(int inMotionType);
[Value] RVec3 GetPosition();
void GetPositionInto([Ref] RVec3 outPosition);
[Value] Quat GetRotation();
void GetRotationInto([Ref] Quat outRotation);
[Value] Mat44 GetWorldTransform();
[Value] RVec3 GetCenterOfMassPosition();
[Value] Mat44 GetCenterOfMassTransform();
@ -198,6 +200,7 @@ interface MassProperties {
// BodyCreationSettings
interface BodyCreationSettings {
void BodyCreationSettings([Const] Shape inShape, [Const, Ref] RVec3 inPosition, [Const, Ref] Quat inRotation, int inMotionType, short inObjectLayer);
attribute short mObjectLayer;
attribute float mFriction;
attribute float mRestitution;
attribute float mLinearDamping;
@ -273,9 +276,39 @@ interface RayCastResult {
attribute float mFraction;
};
// RayCastSettings
interface RayCastSettings {
void RayCastSettings();
};
// BroadPhaseLayerFilter
interface BroadPhaseLayerFilter {
void BroadPhaseLayerFilter();
};
// ObjectLayerFilter
interface ObjectLayerFilter {
void ObjectLayerFilter();
};
// BodyFilter
interface BodyFilter {
void BodyFilter();
};
// ShapeFilter
interface ShapeFilter {
void ShapeFilter();
};
// BroadPhaseQuery
interface BroadPhaseQuery {
void CastRay([Const, Ref] RRayCast inRay, [Ref] RayCastResult ioHit, [Const, Ref] BroadPhaseLayerFilter inBroadPhaseLayerFilter, [Const, Ref] ObjectLayerFilter inObjectLayerFilter);
};
// NarrowPhaseQuery
interface NarrowPhaseQuery {
boolean CastRay([Const, Ref] RRayCast inRay, [Ref] RayCastResult ioHit);
boolean CastRay([Const, Ref] RRayCast inRay, [Ref] RayCastResult ioHit, [Const, Ref] RayCastSettings inRayCastSettings, [Const, Ref] BroadPhaseLayerFilter inBroadPhaseLayerFilter, [Const, Ref] ObjectLayerFilter inObjectLayerFilter, [Const, Ref] BodyFilter inBodyFilter, [Const, Ref] ShapeFilter inShapeFilter);
};
// PhysicsSystem
@ -292,6 +325,7 @@ interface PhysicsSystem {
void SetGravity([Const, Ref] Vec3 inGravity);
[Value] Vec3 GetGravity();
[Const, Ref] NarrowPhaseQuery GetNarrowPhaseQuery();
[Const, Ref] BroadPhaseQuery GetBroadPhaseQuery();
void AddConstraint(Constraint inConstraint);
void RemoveConstraint(Constraint inConstraint);
};