mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-10 07:57:27 +02:00
expose the TREE_SCALE to JS
This commit is contained in:
parent
6533d7fcde
commit
3d1c77d047
2 changed files with 6 additions and 17 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <AvatarData.h>
|
||||
#include <NodeList.h>
|
||||
#include <VoxelConstants.h>
|
||||
|
||||
#include "Agent.h"
|
||||
#include "voxels/VoxelScriptingInterface.h"
|
||||
|
@ -52,6 +53,9 @@ void Agent::run() {
|
|||
QScriptValue voxelScripterValue = engine.newQObject(&voxelScripter);
|
||||
engine.globalObject().setProperty("Voxels", voxelScripterValue);
|
||||
|
||||
QScriptValue treeScaleValue = engine.newVariant(QVariant(TREE_SCALE));
|
||||
engine.globalObject().setProperty("TREE_SCALE", treeScaleValue);
|
||||
|
||||
qDebug() << "Downloaded script:" << scriptString << "\n";
|
||||
qDebug() << "Evaluated script:" << engine.evaluate(scriptString).toString() << "\n";
|
||||
|
||||
|
|
|
@ -1,20 +1,5 @@
|
|||
/* Add your JavaScript for assignment below this line */
|
||||
// Add your JavaScript for assignment below this line
|
||||
|
||||
// here are some examples of things you can call
|
||||
Avatar.position = {x: 0, y: 0.565925, z: 10};
|
||||
Avatar.chatMessage = "I am not a robot!";
|
||||
Avatar.handPosition = {x: 0, y: 4.5, z: 0};
|
||||
// The following is an example of Conway's Game of Life (http://en.wikipedia.org/wiki/Conway's_Game_of_Life)
|
||||
|
||||
// here I'm creating a function to fire before each data send
|
||||
function dance() {
|
||||
// switch the body yaw from 1 to 90
|
||||
var randomAngle = Math.floor(Math.random() * 90);
|
||||
if (Math.random() < 0.5) {
|
||||
randomAngle * -1;
|
||||
}
|
||||
|
||||
Avatar.bodyYaw = randomAngle;
|
||||
}
|
||||
|
||||
// register the call back so it fires before each data send
|
||||
Agent.preSendCallback.connect(dance);
|
Loading…
Reference in a new issue