Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
How to keep my character from catching on the terrain

luposian
Registered User
Quote
2023-02-16 20:13:57

I have a 3D character in a hilly terrain. He has (what I call) a yellow "collision cage" around him. I've resized it so that he can go inside the building asset, but he was so "floaty" it was ridiculous. By "floaty", I mean, his walk-cycle and his movement speed were totally not in sync.

Well, I finally slowed down his movement speed, so he actually moves about the same speed as he's walking (his walk cycle), so it looks like he's actually walking on the ground. However, he now gets stuck quite easily and frequently and I don't know why, other than my suspicion that his "collision cage" is snagging on edges of the terrain. And that's because he's now moving so slowly, the collision detection routine can now "see" everything he's touching and stops him, rather than missing it, like before. Hmm?


Robbo
Guest
Quote
2023-02-17 00:31:12

You will have issues with walking over very low polygon meshes from my experience and need to change the collision:

ccbSetCopperCubeVariable("ActorName.colsmalldistance", 0.05);

// with animation scaled to 0.03: 0.0001 is 80%, 0.001 is 95%, 0.01 is 98%, 0.05 is 99%, 0.15 some issues


luposian
Registered User
Quote
2023-02-17 02:11:57

Is this code that changes the entire CopperCube program or just code that you somehow implement for just our instance (individual use)?

If just our instance, where do we place this code? If it changes CopperCube as a whole, that means a complete recompile, doesn't it?


Robbo
Guest
Quote
2023-02-17 11:17:20

only affects the animated character or player you assign it to.
Also needs a hash "" in front of the name also.


luposian
Registered User
Quote
2023-02-17 22:13:51

But HOW and WHERE do I place this code?


just_in_case
Moderator
Quote
2023-02-18 03:15:05

you can also set the variable directly, it is better if you put the code to your, before first drawing do something behavior. Or it is totaly upto you when you want to change the value of that variable.


luposian
Registered User
Quote
2023-02-19 02:14:59

Does everyone just love talking cryptically or something? I need to know HOW and WHERE to put that code in! As in, "Tell me WHAT file to change and WHERE to change it."


Guest
Guest
Quote
2023-02-19 04:04:51

@luposian

Put a Before First Draw behavior on your root scene node in your scene graph. Add an Execute JS Script action it. Copy and paste this into it:

ccbSetCopperCubeVariable("ActorName.colsmalldistance", 0.05);

Where it says "ActorName" above, you need to substitute the name of the your animated model you want to change. Example: "Soldier.colsmalldistance". Also add the hashtag symbol before the name like so: "<hashtag>Soldier.solsmalldistance".
We can't use the hashtag symbol in the forums.

I recommend you read CC's documentation located here:

https://www.ambiera.com/coppercu...

Also there is a lot of people who use this engine who speak English as a second langauge so please take that into consideration.


luposian
Registered User
Quote
2023-02-19 15:38:15

Thank you. That was far more informative. And, my apologies for my response. It only slightly occured to me (as in, it occured to me as a brief possible thought) that maybe a lack of English skills was responsible for the seemingly cryptic responses. English IS my only language and I tend to forget that not everyone shares that same position.

I'll start digging into the documentation, as so ordered. :-D

Guest wrote:
@luposian

Put a Before First Draw behavior on your root scene node in your scene graph. Add an Execute JS Script action it. Copy and paste this into it:

ccbSetCopperCubeVariable("ActorName.colsmalldistance", 0.05);

Where it says "ActorName" above, you need to substitute the name of the your animated model you want to change. Example: "Soldier.colsmalldistance". Also add the hashtag symbol before the name like so: "<hashtag>Soldier.solsmalldistance".
We can't use the hashtag symbol in the forums.

I recommend you read CC's documentation located here:

https://www.ambiera.com/coppercu...

Also there is a lot of people who use this engine who speak English as a second langauge so please take that into consideration.



luposian
Registered User
Quote
2023-02-19 16:15:00

I think I found it. Is it under behaviors? Is it called "Before first drawing do something"?

Guest wrote:
@luposian

Put a Before First Draw behavior on your root scene node in your scene graph. Add an Execute JS Script action it. Copy and paste this into it:

ccbSetCopperCubeVariable("ActorName.colsmalldistance", 0.05);

Where it says "ActorName" above, you need to substitute the name of the your animated model you want to change. Example: "Soldier.colsmalldistance". Also add the hashtag symbol before the name like so: "<hashtag>Soldier.solsmalldistance".
We can't use the hashtag symbol in the forums.

I recommend you read CC's documentation located here:

https://www.ambiera.com/coppercu...

Also there is a lot of people who use this engine who speak English as a second langauge so please take that into consideration.



Guest
Guest
Quote
2023-02-19 20:09:33

@luposian

That's the one: "Before first drawing do something".

Some of the names of CC's behaviors and actions are a bit tedious to type out so people abbreviate them in all sorts of ways on the forum.

You can also make a js file with the exact same name as your ccb file in your project folder. So if you're ccb is called game.ccb then your js file needs to be called game.js. You can then type in the js file: "print("Hello World!");" and save it and run your game. You should see "Hello World!" display in the debug console. You can then copy and paste Robbo's code into the js file to test it without having to mess around with CC's behaviors and actions.

Definitely check out the documentation to make your life easier.

Cheers.


luposian
Registered User
Quote
2023-02-19 22:07:59

What do you mean by: "// with animation scaled to 0.03: 0.0001 is 80%, 0.001 is 95%, 0.01 is 98%, 0.05 is 99%, 0.15 some issues"? Do you mean the scaled size of the animated mesh? Or something else?

Robbo wrote:
You will have issues with walking over very low polygon meshes from my experience and need to change the collision:

ccbSetCopperCubeVariable("ActorName.colsmalldistance", 0.05);

// with animation scaled to 0.03: 0.0001 is 80%, 0.001 is 95%, 0.01 is 98%, 0.05 is 99%, 0.15 some issues



luposian
Registered User
Quote
2023-02-19 22:12:50

Do you only need the JavaScript within the program or do you need it as an external .js file? Does having both cause any conflict? So far I'm not noticing any difference, but I think I may be doing something wrong.

Does the JavaScript code change the parameters of the yellow collision cage (size/dimension/location) or something else?


Guest
Guest
Quote
2023-02-19 23:06:36

@luposian

I would use either the external js file or the Before First Draw behavior method until you understand more about what you are doing. Here's colsmalldistance from the documentation:

colsmalldistance: The collision "small distance" used by a 'Collide When Moved' behavior. A very small value, set to 0.0005 for example. This affects how the ellipsoid is moved when colliding with a wall. Affects movement smoothness and friction. You can use this to adjust the collision behavior more in depth.
Note: If set to a too big or too small value, this will also may cause the ellipsoid to be stuck.

You can find it under Special Variables here:

https://www.ambiera.com/coppercu...


luposian
Registered User
Quote
2023-02-20 03:51:22

Thanks for the info! Very informative. However, if the hilly terrain (subtle ones and larger) generated is the problem, then would "remolding it" (changing the amount of rise or shape of the terrain within CopperCube) help or do we have to import that texture into, say, Blender and remake it (as there was mention of vertices not matching up exactly being an issue)?

Guest wrote:
@luposian

I would use either the external js file or the Before First Draw behavior method until you understand more about what you are doing. Here's colsmalldistance from the documentation:

colsmalldistance: The collision "small distance" used by a 'Collide When Moved' behavior. A very small value, set to 0.0005 for example. This affects how the ellipsoid is moved when colliding with a wall. Affects movement smoothness and friction. You can use this to adjust the collision behavior more in depth.
Note: If set to a too big or too small value, this will also may cause the ellipsoid to be stuck.

You can find it under Special Variables here:

https://www.ambiera.com/coppercu...



Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (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