Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
multiple actions or javascript

ryanj
Registered User
Quote
2013-08-13 10:40:05

Firstly as a 3D artist and a UI designer and developer second. Coppercube is a brilliant and amazing product Niko. Well done!!

I have one problem with two possible solutions. It's built around the configurator concept. The only thing that's messing me up is the logic.

I have a car and I have imported all the elements individually. e.g. body panels etc. The idea is to click on a body panel and have it go from white to red successively and then back to white to indicate severity of the damage. As far as I can understand it. Adding multiple behaviours to a single node does not work as it only sees the last action you added.

My javascript is very basic and I'm struggling with the logic to make it work. Any help would be greatly appreciated.

Thanks in advance.


erik
Registered User
Quote
2013-08-13 22:15:08

Mutliple behaviors should work, but if you have multiple ones which influence the same thing (like the position), then this will cause conflicts. Depends on what you want to do exactly, there are usually workarounds possible.

If you could write down in detail what you need, we might be able to help you


ryanj
Registered User
Quote
2013-08-14 09:21:00

Thanks for the reply erik.

Alright. I'll try to flesh it out as best I can. I have a 3d model of a car where all the panels on it have been imported as separate items. The function I require is that on click - this item. e.g. FrontRightDoor . It will change to yellow. I have no problem with the first one. Since I'm just changing the texture. But it has to change to red when you click it again and then back to white. And that's pretty much it. I have tried adding more than one action but this hasn't worked as I expected. I come from a predominantly Director - lingo background and in many cases this way of doing things worked very well for multiple actions on an object or node.

I figured that javascript would be the only solution. Though I'm lost when it comes to specifying and structuring variable statements.

Any ideas?


pmax
Registered User
Quote
2013-08-14 13:10:30

I tried to make an example "so I learn something, too."
I am attaching a scene basis that I created.
link : https://www.dropbox.com/s/i01gkq...


PS: translation by Google.


ryanj
Registered User
Quote
2013-08-14 13:47:29

Wow pmax!! That's almost exactly what I'm looking for. How did you do it?


pmax
Registered User
Quote
2013-08-14 14:12:32

Open the file "change_texture.ccb" with CopperCube and controls the whole scene.
Since we use Google to translate everything is very slow to explain.


ryanj
Registered User
Quote
2013-08-14 14:50:08

Ah yes. For some reason my PC seems to have thrown away it's file associations. Thank you very much pmax. This will be perfect. I will post a demo soon.


bigcatrik
Registered User
Quote
2013-08-14 16:17:40

You can do it with a Behavior and multiple Actions which have additional Actions embedded.

When the object is clicked use a variable to keep track of the number of clicks and assign the texture based on that variable. When you're at the end of your sequence, change the texture *and* reset the variable to start over.

Behavior: When clicked on do something
----Action: Add 1 to variable objColor (variables are created equal to zero)

----Action: If objColor = 1
--------Action: Change to texture 1

----Action: If objColor = 2
--------Action: Change to texture 2

----Action: if objColor = 3
--------Action: Change to texture 3
--------Action: set variable objColor to 0


ryanj
Registered User
Quote
2013-09-12 10:44:26

Thanks to everyone for your invaluable input. I ma in the process of finishing up this project and will post the end result soon.


zer0_obscura
Registered User
Quote
2017-08-07 04:48:24

Sorry to revive an old thread. I cant get to the Dropbox link to work. Is there any other type of template I can download that is similar to this one?


pmax
Registered User
Quote
2017-08-07 13:37:46

I restored DropBox link.


Create reply:


Posted by: (you are not logged in)


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