Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi everyone, I would like to know , is it possible to get an animated node(my player) width ? I tried something like this but it returns false: var player = ccbGetSceneNodeFromName("player"); var playerWidth= ccbGetSceneNodeProperty(player, "Width (pixels)"); print('player width is '+playerWidth); Does soemone have I idea please? |
||||
|
How about scale? ScaleX scaleY scaleZ |
||||
|
it doesn't work with scale also unfortunately. I tried and still return false: var player = ccbGetSceneNodeFromName("player"); var playerWidth= ccbGetSceneNodeProperty(player, "ScaleX"); print('player width is '+playerWidth); |
||||
|
var playerScale= ccbGetSceneNodeProperty(player, "Scale"); print(playerScale.x); print(playerScale.y); print(playerScale.z); |
||||
|
I works but I don't think it is what I need. I wanted the player width so that I can move the player in a direction by adding or removin the player width from his PosX here with scale I wont work |
||||
|
HI, unfortunately there is no command to get actual width of any 3D object directly in CopperCube. But here is a workaround to get width of any object. In your 3D scene create a cubemesh with size of 1, attach this cubemesh to the object whose width you want to get by attaching I mean make it children of that object, and change the position to (0,0,0) for the cubemesh. Now the cubemesh will be in the center of your object. Now change the cubemesh material to either transparent or Transparent add, when I said make it transparent I mean also apply a transparent texture to it. Now start scaling the cubemesh to the width and height of your object and that's it. Now, whenever you want to get the width of your object, simply try to get the scale of that cubemesh on the axis that you want to get the width of either X or Z axis and you will have the exact width of your object, it doesn't matter wether it's animated or static. just make sure when you create cubemesh it is of size 1. I also showcased this in one of my YouTube video, but people generally don't notice these tricks in my videos. One can also use the polygon editing API,but that will computationally heavy and won't work with animated objects. Hope this helps you and anybody who needs to achieve the same |
||||
|
I think you need something like this plugin: https://robo25.itch.io/coppercube-editor-mesh-size it will measure the absolute size of any mesh in CopperCube regardless of scale applied. |
||||
|
Actually only works for static mesh - not animated... |
||||
|
@Robbo, also it won't work if collision is off for the object. |
||||
|
Thanks everyone for your answers. I'm gonna try them all and come back to tell you. |
|