Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
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! :-) |
||||
|
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 |
||||
|
Thanks! |
||||
|
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? |
||||
|
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? |
||||
|
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. |
||||
|
|