How to use onTriggerEnter and onCollisionEnter in Typescript

Hello,

I would like to use Collider to make my runner game.
I didn’t find any solution in documentation about Collider in the doc or on the forum.

Do you know how to use this functions in Typescript ?

Original Post on Discord

by user 224464722878005248

Hey you would need to use a Rigidbody (set to kinematic for example) with a collider and a collider on your other object (set to trigger)
Here is the list of callbacks: Needle Engine Scripting | Needle Engine Documentation

But for your usecase i would recommend you try using the SpatialTrigger components (there’s a Trigger and a Receiver component) - they can be used to notify your scripts when they intersect without needing to run physics in the background

Okay I found the component.
So it’s like a TriggerDetection Cube ? How could I get the notification in an other script ?

by user 224464722878005248

There’s a sample in Samples Projects | Needle Engine Documentation - you can either subscribe to the event e.g. on-enter of the SpatialTriggerReceiver component or use the exposed UnityEvents to call your component

Hi,

Sorry, I think I’m blind but, I followed the instruction to obtain the samples
But I’m in trouble with this :

by user 224464722878005248

I git clone it,
Open a new unity project in projects

by user 224464722878005248

But

by user 224464722878005248

What do you mean by “a new unity project” ?

There’s a project in the repository :slightly_smiling_face:

I tried to open project and not the sub folder…

by user 224464722878005248

Ok, version troubles, try to fix it

by user 224464722878005248

What’s the function I need to use in my custom script if it’s custom script that I want activate with my receive TriggerSpatial ?

by user 224464722878005248

Oh, ok
It’s going to add my function createdd in the script to use it
I try

by user 224464722878005248

by user 224464722878005248

by user 224464722878005248

Why my function doesn’t appear ?

by user 224464722878005248

You need to select it in the dropdown

by user 224464722878005248

Further down? :slightly_smiling_face:

Should be an option with ClimbStairs