| RTI SimCreator & SimObserver Support Home |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| dkidd3 |
Posted: Jul 8 2009, 10:20 AM
|
|
Member ![]() ![]() Group: Members Posts: 23 Member No.: 29 Joined: 15-March 07 |
Is it possible to create a custom tile that has proximity sensors such that the javascript file associated with the proximity sensor is exposed/editable after the tile has been published?
|
| hstoner |
Posted: Jul 9 2009, 06:08 AM
|
|
SimVista Forum Moderator ![]() ![]() ![]() Group: Admin Posts: 97 Member No.: 16 Joined: 5-September 06 |
Yes there is.
Create your visual world (tile) as you normally would. Then add in your proximity sensor. Next follow the instructions from the manaul (pg 15 in v2.28) on how to publish the scene as object into your SaveAsObjects. When you have the option to expose fields make sure the userScript field is exposed when you are saving the scene as a release object. Then when you drag it into a new scene from your object gallery you will have the userscript available to reference any javascript file. |
| dkidd3 |
Posted: Jul 17 2009, 08:50 AM
|
|
Member ![]() ![]() Group: Members Posts: 23 Member No.: 29 Joined: 15-March 07 |
If a sensor has been saved into a tile can it still be referenced to in the same manner in JavaScript?
For example, say I have two box proximity sensors named "EventSensor" and "TurnSensor". The javascript for "TurnSensor" references a variable named "startevent" that was created in the "EventSensor". This is done using the following code in the TurnSensor javascript: newvariable = Scenario.EventSensor.startevent; However, if I save both sensors as part of a larger tile do I still reference this variable the same? My concern is now that the box sensor is now part of a larger object that it would lose its unique name and I would need to reference the entire tile that it is embodied in such as newvariable = Scenario.NewLargeTile.startevent; Can anyone provide any insight? |
| hstoner |
Posted: Jul 17 2009, 11:18 AM
|
||
|
SimVista Forum Moderator ![]() ![]() ![]() Group: Admin Posts: 97 Member No.: 16 Joined: 5-September 06 |
Another approach you could take is to assign your variable to the global space. Then you do not have to worry about what sensor it came from. For example, in one sensor say:
Then in all other sensors you can get or set the variable using the same name. It is no longer dependent on what sensor called it first. |
||
![]() |
![]() ![]() ![]() |