Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
on collision

54newstar
Registered User
Quote
2015-08-20 23:12:37

Is there a on Collision command.

On collision, set animation to fall down.

on collision, change texture.


like a bullet hitting a glass window and changing the texture to a broken one or when you hit something it falls over.


jaimezegpi
Registered User
Quote
2015-08-21 03:24:36

Here you can download a basic behavior plugin. do some similar you need.

In download you find
1.- Example
2.- File for ccb
3.- behaviorfile

http://brainxcode.cl/exchange/te...

🔎︎


Luky Man!
On Collision do action.

this by named on proximity.... mmmm...

Conf.
Rad. from object.
Folder of collisionable objects.
Action to do when collision detected.

Really is not a collision sistem is a proximity detector.
i hope help to some one


rolevix
Registered User
Quote
2015-08-21 11:49:35

Download link is not work


niko
Moderator
Quote
2015-08-21 12:05:42

You can also use the built-in "on proximity do something" behavior, it is not that precise because it uses a radius, but still probably works for stuff like bullets and windows and similar.


bob
Guest
Quote
2015-08-21 13:28:42

CC need really need to have a more complex system for collision detection for 3d node...based on meshes or triangle intersection detection...
but proximity detection based on a sphere radius is not very usefull in certain cases...
really need to improve this in future...


jaimezegpi
Registered User
Quote
2015-08-21 14:11:03

You have reason bob .. need more basic commands.
like on collision, pitch , roll, yaw objects using quatenions, emissive textures and much more... etc...
(you can see old scool api , like blitz, or darkbasic they are well complemented)

HA ! i fix the download sorry for that.

For now this is i can make using the existing list of commands for detect a basic "collision" or better "proximity" (is not the same).


54newstar
Registered User
Quote
2015-08-21 18:38:01

wrote:
You can also use the built-in "on proximity do something" behavior, it is not that precise because it uses a radius, but still probably works for stuff like bullets and windows and similar.



I had a request to do a tutorial on collision boxes with characers. So i attached cubes to the bones and if the bullet was really close to it then an animation was produced. It works but a bullet on collisoin with said oject would have been better.


volt
Registered User
Quote
2016-03-16 16:47:28

I tried the download link but it did not have the behavior or ccb file. Can you upload again?


volt
Registered User
Quote
2016-03-16 16:47:54




volt
Registered User
Quote
2016-03-16 16:48:32

I tried the download link but it did not have the behavior or ccb file. Can you upload again?


jaimezegpi
Guest
Quote
2016-03-17 00:18:01

ups sorry
here is the link
http://brainxcode.cl/exchange/in...


forloops
Registered User
Quote
2021-11-11 19:03:45

Still can't use the download link. I am using chrome. Does this change anything?


Guest
Guest
Quote
2021-11-11 22:37:03

@forloops

I looked through my saved example scripts and found this code. Just paste the code in a text file, and save it as behavior_OnCollision.js in your CC extensions folder. Hope this helped.


/*
<behavior jsname="behavior_OnCollision" description="Execute on collision">
<property name="Radio" type="int" default="5" />
<property name="SceneFolder" type="scenenode" />
<property name="ActionToDo" type="action" />
</behavior>
*/


behavior_OnCollision = function()
{
};

behavior_OnCollision.prototype.onAnimate = function(node, timeMs)
{
this.pos = ccbGetSceneNodeProperty(node, 'Position');
this.rot = ccbGetSceneNodeProperty(node, 'Rotation');
this.name = ccbGetSceneNodeProperty(node, "Name");
this.node = node;
var root = this.SceneFolder;
var count = ccbGetSceneNodeChildCount(root);

for(var i=0; i<count; ++i)
{
var child = ccbGetChildSceneNode(root, i);
var child_name = ccbGetSceneNodeProperty(child, "Name");
if (this.name !== child_name && child_name!=="")
{
var target_pos = ccbGetSceneNodeProperty(child, 'Position');
var target_rot = ccbGetSceneNodeProperty(child, 'Rotation');

if (target_pos.x>this.pos.x-this.Radio && target_pos.x
<this.pos.x+this.Radio && target_pos.y>
this.pos.y-this.Radio && target_pos.y
<this.pos.y+this.Radio && target_pos.z>
this.pos.z-this.Radio && target_pos.z
<this.pos.z+this.Radio)
{
ccbInvokeAction(this.ActionToDo,this);
}

}
}
}



/*
Hi!!.
if you ned help
jaimezegpi@yahoo.es
*/



Create reply:


Posted by: (you are not logged in)


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