mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 21:36:45 +02:00
* Addresses physics library dependency by moving computeShapeInfo override from ShapeEntityItem (which is within Entities Library) to RenderableShapeEntityItem (which is in Entities-Renderer Library). ** Entities-Renderer library already links against the physic library. ** Per discussion with Andrew Meadows: In order to ShapeEntityItem to be utilized the library dependency between the Entity and Physics library would need to be resolved to avoid the cyclical reliance which isn't in the scope of this ticket. * Updates shapeSpawner test script from the default clone of basicEntityTest\entitySpawner.js ** Objects now have a finite lifetime ** Script now cleans up the objects created when the script ends ** Also moved some adjustable properties out into var aliases at the top of the file for easier/less error prone tweaking. Should probably add one for the shapeType. * Fixes some issues with validateShapeType helper function * Removed naive attempt at including physics library within entities library. * Transferred some todos from notes * Fixed some formatting NOTE(s): This compiles and runs. Cylinder is spawned and treated as CYLINDER_Y. TODO(s): * Add tweakable var for shapeType within shapeSpawner.js * Vet and verify other shapes. * Add in edge case handling. * Add in support for other shapes to ShapeInfo infrastructure. Changes to be committed: modified: libraries/entities-renderer/src/RenderableShapeEntityItem.cpp modified: libraries/entities-renderer/src/RenderableShapeEntityItem.h modified: libraries/entities/CMakeLists.txt modified: libraries/entities/src/ShapeEntityItem.cpp modified: libraries/entities/src/ShapeEntityItem.h modified: libraries/physics/src/ShapeFactory.cpp modified: libraries/shared/src/ShapeInfo.cpp modified: scripts/developer/tests/basicEntityTest/shapeSpawner.js
30 lines
849 B
JavaScript
30 lines
849 B
JavaScript
// compute a position to create the object relative to avatar
|
|
var forwardOffset = Vec3.multiply(2.0, Quat.getFront(MyAvatar.orientation));
|
|
var objectPosition = Vec3.sum(MyAvatar.position, forwardOffset);
|
|
|
|
var LIFETIME = 1800; //seconds
|
|
var DIM_HEIGHT = 1, DIM_WIDTH = 1, DIM_DEPTH = 1;
|
|
var COLOR_R = 100, COLOR_G = 10, COLOR_B = 200;
|
|
|
|
var properties = {
|
|
name: "ShapeSpawnTest",
|
|
type: "Shape",
|
|
shape: "Cylinder",
|
|
dimensions: {x: DIM_WIDTH, y: DIM_HEIGHT, z: DIM_DEPTH},
|
|
color: {red: COLOR_R, green: COLOR_G, blue: COLOR_B},
|
|
position: objectPosition,
|
|
lifetime: LIFETIME,
|
|
};
|
|
|
|
// create the object
|
|
var entityId = Entities.addEntity(properties);
|
|
|
|
function cleanup() {
|
|
Entities.deleteEntity(entityId);
|
|
}
|
|
|
|
// delete the object when this script is stopped
|
|
Script.scriptEnding.connect(cleanup);
|
|
|
|
|
|
|