no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


0.8.4:triggerpoints [2022/06/21 21:34] (current) – created admin
Line 1: Line 1:
 +====== Trigger Points ======
  
 +TriggerPoints are 3D positions in your 3D world space. Those can be static or dynamic (moving). For example you have another character you want to talk to. You can set up a dynamic trigger point for the model and the system will automatically check when it's getting close enough.
 +In a triggerpoint specific event you can react on that feedback and start the conversation ([[Dialogues|Dialogues]]).
 +
 +<file pascal>
 +
 +procedure TGameWindow.DoOnWheelTriggered(ASender : TGorillaTriggerPointManager;
 +  const APos, AViewDir : TPoint3D; const APoint : TGorillaTriggerPoint;
 +  const ADistance : Single);
 +begin
 +  FMX.Types.Log.D('wheel triggered');
 +end;
 +
 +procedure TGameWindow.DoOnWheelUnTriggered(ASender : TGorillaTriggerPointManager;
 +  const APos, AViewDir : TPoint3D; const APoint : TGorillaTriggerPoint;
 +  const ADistance : Single);
 +begin
 +  FMX.Types.Log.D('wheel untriggered');
 +end;
 +
 +  [...]
 +
 +
 +FTriggerPoints := TGorillaTriggerPointManager.Create(Self);
 +// we don't want to check against camera, but againts the character model
 +FTriggerPoints.RelatedControl := FCharacter;
 +FTriggerPoints.Enabled := true;
 +
 +// creata a single trigger point at runtime
 +LTP := FTriggerPoints.AddTriggerPoint('Wheel1', Point3D(-10, 0, 10), 0.25, 30);
 +LTP.LookInDirection := false; // trigger only if character is nearby
 +LTP.Kind := TGorillaTriggerPointKind.StaticTriggerPoint;
 +LTP.Data := TValue.From<String>('Press [E] to rotate wheel #1');
 +LTP.Tag  := 1;
 +LTP.OnTriggered := DoOnWheelTriggered;
 +LTP.OnUnTriggered := DoOnWheelUnTriggered;
 +</file>