Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Move Object By 3D Position Issue?

sixvivid
Registered User
Quote
2023-03-16 11:47:15

Can somebody please help me figure out why what im trying to do isnt working lol i dont understand as I have done this same things with the same method I always do and has always worked?

I am trying to have the player get teleported into the "dungeon" (2d room map) when they press a button(while near entrance as determined by proximity behaviors and variables).

The player isnt going anywhere, nothing happens. :/

@just_in_case please help :)

heres a link to a video where I show my behaviours for this mechanic and the bug as well.


just_in_case
Moderator
Quote
2023-03-16 12:11:05

Can't see the video link, and will not be able to answer what issue you are facing, as I don't know how you are implementing the change position. Are you using scripted commands to teleport the player or using the inbuilt behavior to change the position of the player?

Also as you are saying that you are using proximity behaviors, so probably need to make sure that all the proximity triggers are working, you can try that by printing the value of the variable to 2D overlays or in the debug console so that you can confirm that it is not the proximity behaviors causing the issue. As proximity behavior gets triggered by the origin of the object.

it is always better to apply the proximity behavior to the object if they are large in size, instead of the player, if your player is smaller than the object then applying proximity behavior to the player might lead to no-proximity as the origin of the object can be outside the proximity while the object is actually in the proximity of the player.

The case can be opposite for proximity checking with smaller object, if your player is larger than the objects, it is better to attach the proximity behavior to the player.
Make sure that the proximity behaviors are set-up correctly.

It is also better to use dummy nodes, or empty nodes to check proximity for larger object, for example if you have a house and you want to check the proximity with windows only, then you can create an empty node and place it in the window position of the house, and now you can test the proximity with that dummy node instead of the house.

hope checking these will fix your problem, if not then please explain your issue in more detail, or provide the link to the video that you are talking about.


sixvivid
Registered User
Quote
2023-03-16 22:20:30

The proximity check is working great as the "Enter Dungeon" picture shows up as its supposed to, only the "Move Object > Set 3D Position" is not doing anything and im not sure why


sixvivid
Registered User
Quote
2023-03-16 22:22:15

@just_in_case

Also thank you very much for replying so fast, I appreciate it.
I have been using your engine for about 3 or 4 years now and will continue to :) It is impressively capable!


sixvivid
Registered User
Quote
2023-03-16 22:28:11

@just_in_case

Also, I tried changing it from setting the players position to the
coordinates, and instead creating a cube with no collision at the location I want the player to get teleported, and changed
it to "Change Relative to Scene Node (0.0, 0.0, 0.0)"

This had no effect, same bug.

If its helpful, I am using a character model with a "Third Person Camera Controller" set to follow it. The camera has no collision, and I told it to restart behaviours of character model right after teleport.

Still nothing :/

I have done this before with the same method and it worked, so I'm wondering if it has to do with the Third Person Camera?

Thanks, SixVivid


sven
Registered User
Quote
2023-03-16 23:02:41

Tested it and it works for me.
make sure you are moving character not the camera.
that means you need to teleport the character (camera will follow it).

restarting behaviours for character also not the camera.

(with Physics simulation it doesnt work)


just_in_case
Moderator
Quote
2023-03-17 04:11:01

I also tested it an it works for me as well, for both physics simulation and collision only.

The reason you might see that it is not working is that it moves with the collision enabled, in physics simulation, it makes the player bounce up and then it bounces the player to somewhere else which makes it look as if it is not working.

The same goes with the collision simulation, it moves the character with collision, so when you change the position of the player, it might put the player just outside the dungeon room, or near the point of collision.

to confirm that it is the issue of Collision detection, you can simply remove the "Collide when moved behavior" and test the app again. Your player will change the position correctly.

in order to change the position of the object with the "Collide when moved" behavior attached so that it can change position without jumping or bouncing back to another position. You can use this javascript command to change the position of your object without collision.

var s = ccbGetSceneNodeFromName("cubeMesh1");
ccbSetSceneNodePositionWithoutCollision(s, x, y, z);


simply rename the "cubeMesh1" in the above code with the name of your player node, make sure it remains in Quotes, and change the "X, Y, Z" with the position of your dungeon or with the position where you want your player to be.

You can put the above code in the execute javascript action.

Also, this is not my engine, I am just a user like you. @Ambiera owns the engine. hehehe

Hope this solves your issue.


sixvivid
Registered User
Quote
2023-03-18 05:53:12

@sven Yeah, I did. As I said i've done this many times before as well, and doenst make sense why it isnt working.

Yes, I am moving the character... Didnt I say I've been developing for years? Would have thought you'd know this a month into developing...


sixvivid
Registered User
Quote
2023-03-18 05:54:31

@just_in_case

Thank you so much, I have been reading and looking for this syntax but havent found it! Much appreciated, and I have ongoing projects all using your engine, if you'd like to see them
when they're done just say so! :)


sixvivid
Registered User
Quote
2023-03-18 06:01:49

@just_in_case I know it's not your engine, you're seemingly the most involved user is all and have indirectly helped me with many bugs reading other replies from you in other feeds!


sixvivid
Registered User
Quote
2023-03-18 06:02:20

What is the "s" in (s, x, y, z)

Size?

Speed?


sixvivid
Registered User
Quote
2023-03-18 06:02:57

nevermind, I read the code again... I'm tired.


sixvivid
Registered User
Quote
2023-03-18 06:06:02

@just_in_case

......Your script didnt work... i've seen this code implemented in many projects and it works great. It STILL isnt working. Is it because the position is in the negative range of the Y axis?

If so, that is really dumb because terrain is 0,0,0 by default and unmovable. The dungeon needs to be underground so that you cant look up(in game) and see the dungeon floating in the sky......


just_in_case
Moderator
Quote
2023-03-18 07:01:56

Hi there, @sixvivid, the script does work very well, it doesn't matter what is the position, if it's negative or something else. it will always change the position without any issue.

"s" in the script is a variable that stand for "scenenode" and it hold the data which scenenode we are going to move or change position.

just to clarify that the code works, here is a sample ccb file, in which the cube has third person camera attached to it , which you can move with WASD, and on pressing "F" key the position of the cubemesh gets changed to the Dungeon I created using 2D room maps, below the terrain.
https://cdn.discordapp.com/attac...

Also in the script, you can provide any position, you don't specifically need to provide position of your object, like you are not bound to use terrain position only. You can create a dummy node, and put it somewher in your scene where you want to telport or move your object. You then copy it's position and paste those position cordinate into the script.


Also, @sven has released an action, using the same thing that can help you out, so that you don't have to deal with the scripting part. you can download the extension by @sven from here.https://5v3n.itch.io/coppercube-...

I would really love to see your game in action, and I am glad that I am of any help to you


sixvivid
Registered User
Quote
2023-03-18 09:49:03

Yes I know i did all of this exactly and it dont work, except maybe its my player model, i dont know. What i do know is i did it again in a different project (both are just as empty so shouldnt make a difference) and it worked in the second project.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

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


   






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