≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Action script crash problem
Posted by:
(you are not logged in)
Enter the missing letter in: "Interna?ional"
(you are not logged in)
Text:
[quote][b][/b] wrote: there are a few mistakes in your script code as I can see. you are using[code] ccbGetSceneNodeFromName[/code] in a wrong method. while you don't have to use this code at all. if you ever wish to use that code, then you can't use it with properties of the action like you are using [code] this.npc and this.Target[/code] you need to use the name of actual object from the editor in string format like this [code]"cubeMesh1[/code] so instead of using [code] ccbGetSceneNodeFromName(this.npc);[/code]use [code]ccbGetSceneNodeFromName("npc");[/code] however if you are using property as a type of "scenenode" then you actually don't have to use the above command to get the name of the scenenode. you can directly call an object or change its properties by using [code]this.propertyname[/code] property should be a type of scenenode. then you can simply use this command to get the position of an object [code] var targetpos = ccbGetSceneNodeFromName(this.Target,"Position");[/code] there is no need to call the object by name simply use the property type. so this makes the whole code corrupted and you get an error could not get the property because you are calling the object in the wrong fashion. here is how the final script should goes:- [code] /* <action jsname="action_AiMoveTo" description="Move AI npc to target node's position"> <property name="npc" type="scenenode" /> <property name="Target" type="scenenode" /> </action> */ action_AiMoveTo = function() { }; action_AiMoveTo.prototype.execute = function(currentNode) { var targetpos = ccbGetSceneNodeProperty(this.Target, "Position"); ccbAICommand(this.npc, "moveto", targetpos); };[/code] hopefully, this should work. let me know if this don't works. *holy**holy*[/quote]
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