Character physics at merge cube

Hi, I’m trying to make a level for the merge cube where the character walks through it to a certain goal (to teach the concept of algorithm in children) but the character when I put him to walk goes out of the limits of the cube and does not follow where he has to follow, how do I make him stay “glued” to the cube while I turn it to take advantage of all the space? Greetings and thanks, I attach a screenshot.

3 Likes

Hi @Carlos_Gonzlz, I dont have a merge cube myself, so unfortunatly I can’t test this when rotating the cube; But would using a path be a viable solution?

1 Like

Hi @Luc, thanks for replying. Yes I saw that a path feature is available, but I don’t think it can solve my problem, since I need to say put the character but the student can manage it (style put arrows on the ground and move around the cube) but still I will try it thanks!.
Attached is a screenshot of the style I would say I have in mind.

@Carlos_Gonzlz Ah I see, well what I could think of is using a trigger at the edge of the cube to rotate the character. This is by no means a foolproof solution but maybe with some tweaks it could work better. The only restriction is that the character must always face the direction they are walking in (also no animation time on rotating as this would cause issues).

I’ve implemented the movement system using the arrowkeys just for a quick example, also the movement is really bad and will bug out when pressing mutlple at the same time, but figured it gets the point across. Hope this helps!

If you still have questions on how it works I’m happy to help.
(Also you can hide the yellow lines, even though they are very small, by making the groups transparency 0%)

Hi @Luc ! Really appreciate your help,your code has helped me a lot and has given me several good ideas, I have continued testing it with the idea that I have that the user has arrows attached while performing the movement to go counting the steps performed and go step by step until you reach the “goal” and the only problem I have found when trying to mix your code with what I had is that when following the areas of the cube I guess I would have to make the arrows were with the character, but I do not quite know how to do it, attached video. A greeting and thank you very much for the quick and good help.

1 Like

@Carlos_Gonzlz, you wont need to move the arrows on their own, if you add them all as “children” to the character (drag and drop them on the boy) they will automatically follow; That will mean however that they will rotate if the boy for instance looks left or right aswell, you could counteract this by grouping all the arrows and always rotating the group the opposite way of the boy when the boy rotates. That would make it look like this in your editor:

  • Casual Boy
    • ArrowButtons(Group)
      • ArrowUp
      • ArrowDown
      • ArrowLeft
      • ArrowRight

I’ve updated the Cospace, it now has mockup arrows attached to the boy, it’s also programmed a bit more defensively so that the boy should no longer make wrong rotations and I have shortened the code for the bounding box; Technically it works the same as the old one but I’ve grouped the X,Y and Z boxes in one, with indexes (0,1,2,3) representing X, (4,5,6,7) representing Y and (8,9,10,11) representing Z.

1 Like

@Luc Oh my god thank you very much, you have helped me a lot with this last update in the cospace, I leave the topic open until I finish the code in case I have any questions but the only question I can think of is if the arrows you have used in the previous cospace are 3D objects, right? It is that when I try to do it with images I get something strange because they are “introduced” in the cube, so far anyway it has helped me a lot! Thank you very much!

1 Like

Hey Carlos, no problem I’m glad I could help! I think it should still work fine with images instead of the 3d objects, if it doesn’t you could instead make a invisible cube that’s the same size as the image and make the image a “child” of it, doing so for each arrow.
If you are using my system for moving it is important the object that is being clicked on is perfectly parallel to the boy; This because I rotate the boy to look at the item thats being clicked to indicate the direction, if its off by even a little bit it will start to rotate the boy slightly off each time, and when crossing a corner this will cause the boy and arrows to be rotated slightly crooked.
I’ve also implemented the arrow rotation thing I described, purely visual but it looks a bit neater having the arrows stay in the same orientation.

Hi Luc, sorry to be heavy, I’ve been trying to work on what you said and I find it very complicated to put the cospaces with other characters so they can perform certain tasks such as taking a key, I tried with a pirate but I would say that the hitbox to be somewhat different than the normal guy does not perform quite well the change of position with the triggers and buggea enough, I also tried to develop something to test “the limits” to simulate a path, i put grass but i’ll try to put rocks or something like that. I share the cospace in which I am editing to see if you can give me a cable or tell me how to fix it, greetings and thank you very much.

Hi Carlos, don’t worry you’re not and I really like the game you’ve made so far.
The weird bug you got where the pirate rotated strangly is what I described in my last comment; That the arrows were like 0.01 offset on the x axis causing the pirate to rotate a little more than 90 degrees each time. I’ve fixed it and added a function to keep track of the last position by adding an invisible object; If the player hits a grassblock it will now turn around and move back to its original position. Good luck with the rest of the game, if you have other questions feel free to ask!

@jack_barsky That’s a nice nice idea however making something like this for CoSpaces seems incredibly difficult, as just by giving it a quick try I’m running into many problems already and the system is far from working. Making it work for a flat plane is relatively easy but I struggle to make an intuitive version for a cube, and feel it would make for a long and ultimately complicated code.

I’d be curious to see if you would make a working example on a cube and how you’d go about it; For this would be the better (and foolproof) option.
Attached my planar version of a NavMesh.

1 Like