mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 12:20:00 +02:00
untip cow
This commit is contained in:
parent
cc92294d16
commit
721b940441
2 changed files with 28 additions and 2 deletions
|
@ -1,3 +1,18 @@
|
||||||
|
//
|
||||||
|
// cowEntityScript.js
|
||||||
|
// examples/cows
|
||||||
|
//
|
||||||
|
// Created by Eric Levin on 3/25/16
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This entity script handles the logic for untipping a cow after it collides with something
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
Script.include("../libraries/utils.js");
|
Script.include("../libraries/utils.js");
|
||||||
|
|
||||||
|
@ -15,7 +30,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.collisionWithEntity = function(myID, otherID, collisionInfo) {
|
this.collisionWithEntity = function(myID, otherID, collisionInfo) {
|
||||||
print("EBL COLLISION WITH ENTITY!");
|
|
||||||
if(_this.shouldUntipCow) {
|
if(_this.shouldUntipCow) {
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
_this.untipCow();
|
_this.untipCow();
|
||||||
|
@ -28,7 +42,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.untipCow = function() {
|
this.untipCow = function() {
|
||||||
print("EBL UNTIP COW");
|
|
||||||
// keep yaw but reset pitch and roll
|
// keep yaw but reset pitch and roll
|
||||||
var cowProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]);
|
var cowProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]);
|
||||||
var eulerRotation = Quat.safeEulerAngles(cowProps.rotation);
|
var eulerRotation = Quat.safeEulerAngles(cowProps.rotation);
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
//
|
||||||
|
// cowSpawner.js
|
||||||
|
// examples/cows
|
||||||
|
//
|
||||||
|
// Created by Eric Levin on 3/25/16
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This spawns a cow which will untip itself
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
var orientation = MyAvatar.orientation;
|
var orientation = MyAvatar.orientation;
|
||||||
orientation = Quat.safeEulerAngles(orientation);
|
orientation = Quat.safeEulerAngles(orientation);
|
||||||
orientation.x = 0;
|
orientation.x = 0;
|
||||||
|
|
Loading…
Reference in a new issue