Hi
Is there an Everywhere Update Action? Because I want to do some logic in Update, but I can’t seem to make it work on iOS Quicklook, without this.
br,
Max
Hi
Is there an Everywhere Update Action? Because I want to do some logic in Update, but I can’t seem to make it work on iOS Quicklook, without this.
br,
Max
Hi Max,
Yes, there are ways to perform actions akin to an “Everywhere Update Action” in Needle Engine, especially for iOS QuickLook. The typical approach would involve using the available low-level triggers and actions to create custom actions tailored to your needs.
In the context of QuickLook, you can create custom Everywhere Actions using the TriggerBuilder
and ActionBuilder
API. Since QuickLook doesn’t support all functionalities, make sure to think creatively about possible implementations. For example, you could cover placement areas with invisible objects to simulate raycasting.
To implement functionality in an update-like manner, consider using a combination of the available low-level actions such as ActionBuilder.transformAction
or ActionBuilder.playAudioAction
based on specific triggers like TriggerBuilder.tapTrigger
.
Here’s a brief outline of how you might structure a custom Everywhere Action for your logic:
ActionBuilder
to perform the desired behavior.For more specific guidance, consulting the documentation about creating your custom actions could be beneficial: Needle Engine Docs.
If you encounter further issues or have specific requirements for your logic, feel free to share more details to assist you better!
Best regards.
1 replies left - Get a PRO license for more AI replies.
thread_xL5Ur0xSU0ekrkYTZDwbAmh3
Reply to this message to continue the conversation
Can you show me how to use ActionBuilder.transformAction?
Hi Max,
To use ActionBuilder.transformAction
, you can follow the structure below. This action moves an object to a target’s position, and you can specify the duration of the transformation and whether the movement is relative or absolute.
Here’s a code snippet demonstrating how to implement ActionBuilder.transformAction
:
import { ActionBuilder, TriggerBuilder, BehaviorModel } from "@needle-tools/engine";
class MoveObjectOnClick {
object: Object3D; // The object you want to transform
target: Object3D; // The target position object
duration: number; // Duration of the movement
relativeMotion: boolean; // If true, moves relative to the object's current position
constructor(object: Object3D, target: Object3D, duration: number, relativeMotion: boolean) {
this.object = object;
this.target = target;
this.duration = duration;
this.relativeMotion = relativeMotion;
}
setupMovementBehavior(ext: BehaviorExtension) {
const moveAction = new BehaviorModel(
"Move " + this.target.name,
TriggerBuilder.tapTrigger(this.object), // Trigger the movement on tap
ActionBuilder.transformAction(this.object, this.target, this.duration, this.relativeMotion ? "relative" : "absolute")
);
ext.addBehavior(moveAction);
}
}
true
, the object will move relative to its current position; if false
, it will move to an absolute position defined by the target’s position.You would instantiate MoveObjectOnClick
, passing in the necessary objects and parameters, and then call setupMovementBehavior
with the extension context.
For additional details on working with various actions and triggers, refer to the Needle Engine documentation.
If you need more specific adjustments or explanations, please let me know!
0 replies left - Get a PRO license for more AI replies.
thread_xL5Ur0xSU0ekrkYTZDwbAmh3
Reply to this message to continue the conversation