ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator getCurrentNode in "on proximity do"
person icon
drnibbert
Registered User
Quote
2026-08-10 09:42:09

Hello,

how can i convince Coppercube to return the name of the node, that holds the "on proximity do"-Action, when using ccbGetCurrentNode inside the Action of "On Proximity do"?

I see the point why it returns the name of the object, that Enters the Proximity-Radius - but i need the name of the 'other' object - just like ccbGetCurrentNode() works everywhere else.

Is there a better way to access the name of the object, that holds the "On Proximity do"-Action from inside the Action of "On Proximity"? (except hardcoding it)

Thanks a lot! :-)

person icon
okeoke
Registered User
Quote
2026-08-10 10:57:32

I guess, simplest one would be passing the node that holds on proximity behavior or it's name as action parameter. I.e. add
<property name="mainNode" type="scenenode" default="" />
Then specify it extensively and get using ccbGetSceneNodeProperty

person icon
drnibbert
Registered User
Quote
2026-08-10 11:15:01

Thanks! emoji icon_smile But that doesn't work with inline-code, that is executed from the On-Proximity-Action under "Action", right? emoji icon_sad So it would be similar to hardcoding the Name of the node in the code-editor, just more convenient?

person icon
okeoke
Registered User
Quote
2026-08-10 15:12:10

Oh, ok. Inline script - I guess there is no way to do it reliably.

In case there are not many nodes like that I would just hardcode, otherwise maybe rewrite default on proximity behavior to have access to both nodes.

But what is your usecase for that?

person icon
drnibbert
Registered User
Quote
2026-08-10 18:49:11

thanks! the idea to create a custom "on proximity"-action is very good!

in my case a moving platform is detecting if the player is standing on it, and telling the player-controller wich movement vector (global variable, platform node name + _movement_vec) to read.
Right now i just hardcoded the platforms name into the code - but once i have hundrets of platforms this will become somewhat confusing :-D

there is probably a way to do it the other way around... or use a raycast-check mayboe?

person icon
okeoke
Registered User
Quote
2026-08-10 19:22:53

There is a solution by Sven:
https://5v3n.itch.io/coppercube-moving-platforms I'm not sure if it fits your game though.

Overwise, in case if platforms are not rotating, it's probably shouldn't be hard to detect collision - I guess it's just circle vs rectangle on x, z, and then y height check.

But I'd actually try another thing:
1. Put all platforms inside folder, so it is easy to get children and loop other them
2. Check squared distance to each platform
3. If it it's less then a threshold - raycast down from player to detect if player is standing on top of the platform. Since you're looping through all children you know exactly which node the player stands on.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |