Some more position access fixes
This commit is contained in:
parent
23d649fe32
commit
cfbe3a7dce
|
@ -62,7 +62,7 @@ class PhysicsBreak extends Trait {
|
|||
var ud = breaker.userDataMap.get(cast o);
|
||||
var params = [0.04, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.04, 0.0, 0.0, 0.0];
|
||||
o.addTrait(new RigidBody(Shape.ConvexHull, ud.mass, ud.friction, 0, 1, params));
|
||||
if (cast(o, MeshObject).data.geom.positions.length < 600) {
|
||||
if (cast(o, MeshObject).data.geom.positions.values.length < 600) {
|
||||
o.addTrait(new PhysicsBreak());
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class ConvexBreaker {
|
|||
}
|
||||
|
||||
public function initBreakableObject(object: MeshObject, mass: Float, friction: Float, velocity: Vec4, angularVelocity: Vec4, breakable: Bool) {
|
||||
var ar = object.data.geom.positions;
|
||||
var ar = object.data.geom.positions.values;
|
||||
var scalePos = object.data.scalePos;
|
||||
// Create vertices mark
|
||||
var sc = object.transform.scale;
|
||||
|
@ -550,11 +550,11 @@ class ConvexBreaker {
|
|||
var inda = new kha.arrays.Uint32Array(ind.length);
|
||||
for (i in 0...ind.length) inda.set(i, ind[i]);
|
||||
|
||||
var pos: TVertexArray = { attrib: "pos", values: paa };
|
||||
var nor: TVertexArray = { attrib: "nor", values: naa };
|
||||
var pos: TVertexArray = { attrib: "pos", values: paa, data: "short4norm" };
|
||||
var nor: TVertexArray = { attrib: "nor", values: naa, data: "short2norm" };
|
||||
var indices: TIndexArray = { material: 0, values: inda };
|
||||
|
||||
var rawmesh: TMeshData = {
|
||||
var rawmesh: TMeshData = {
|
||||
name: "TempMesh" + (meshIndex++),
|
||||
vertex_arrays: [pos, nor],
|
||||
index_arrays: [indices],
|
||||
|
|
|
@ -331,7 +331,7 @@ class KinematicCharacterController extends Trait {
|
|||
}
|
||||
|
||||
function addPointsToConvexHull(shape: bullet.Bt.ConvexHullShape, scale: Vec4, margin: Float) {
|
||||
var positions = cast(object, MeshObject).data.geom.positions;
|
||||
var positions = cast(object, MeshObject).data.geom.positions.values;
|
||||
|
||||
var sx = scale.x * (1.0 - margin);
|
||||
var sy = scale.y * (1.0 - margin);
|
||||
|
|
|
@ -97,7 +97,7 @@ class PhysicsHook extends Trait {
|
|||
#end
|
||||
|
||||
var geom = cast(object, MeshObject).data.geom;
|
||||
var numNodes = Std.int(geom.positions.length / 4);
|
||||
var numNodes = Std.int(geom.positions.values.length / 4);
|
||||
for (i in 0...numNodes) {
|
||||
var node = nodes.at(i);
|
||||
#if js
|
||||
|
|
|
@ -92,7 +92,7 @@ class SoftBody extends Trait {
|
|||
object.transform.buildMatrix();
|
||||
}
|
||||
|
||||
var positions = fromI16(geom.positions, mo.data.scalePos);
|
||||
var positions = fromI16(geom.positions.values, mo.data.scalePos);
|
||||
for (i in 0...Std.int(positions.length / 3)) {
|
||||
v.set(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2]);
|
||||
v.applyQuat(object.transform.rot);
|
||||
|
|
Loading…
Reference in a new issue