Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

GetPosition from 3rd nested Actor is wrong!

A topic by SunnyDrake created Mar 30, 2018 Views: 253
Viewing posts 1 to 1

posted a bug here https://github.com/superpowers/superpowers-game/issues/188

hi im trying to draw line in three.js from one dynamically created Actor model to another

1st level is 0,0,0 actor
2nd level of nested Actors give correct cords and line is ok 
3rd level of nested Actors give incorrect cords and line is wrong
code>>>
let toStar=(this.map[1] as Sup.Actor);
let staractor=(this.map[0] as Sup.Actor);
let toStarp=toStar.getChildren()[0].getPosition();
let staractorp=staractor.getChildren()[0].getPosition();
let g=new THREE.Geometry();
g.vertices.push(new THREE.Vector3(staractorp.x,staractorp.y,staractorp.z));
g.vertices.push(new THREE.Vector3(toStarp.x,toStarp.y,toStarp.z));
let line=new THREE.Line(g,new THREE.LineBasicMaterial({color:0xFFFFFF,opacity:0.5} ));

tryed to compute via recursion add getLocalPosition()+getParent().getPosition() but values are still wrong...