What am i doing wrong here? (This is only main part of script)
Code: Select all
version "4.2"
const box_triangles = 12; //if no MD3 has been found, make standard box shape.
struct vector3d {
vector3 p1;
vector3 p2;
}
class Tris {
vector3 normal;
float rad; //Radius, for check
vector3 p1;
vector3 p2;
vector3 p3;
}
class PhysModel {
Array<class<Tris> > tri;
float friction;
int Type;
}
class PhysActor : Actor { //Kinda :P
class<PhysModel> Body; //This is gonna be the actor's NEW BODY! (Instead of his box shaped body)
override void PostBeginPlay() {
Actor mo, mo2; //temp actors
if(Body == null) {
//Body = new('PhysModel');
Tris tri_temp = new('Tris');
vector3 p_temp[box_triangles * 3] = {
(radius, radius/2, -height/2),
(radius, -radius/2, -height/2),
(radius, radius/2, height/2)
};
for(int i = 0; i < 1; i++) { //1 for testing, set it to "box_triangles" maybe..
tri_temp.p1 = p_temp[3 * i + 0];
tri_temp.p2 = p_temp[3 * i + 1];
tri_temp.p3 = p_temp[3 * i + 2];
Body.Tri.Push(tri_temp);
}
Body.type = 0;
}
for(int i2 = 0; i2 < Body.Tri.Size(); i2++) {
Body.Tri[i2].normal = CalculateNormal(Body.Tri[i2].p1, Body.Tri[i2].p2, Body.Tri[i2].p3);
for(int i3 = 0; i3 < 3; i3++) { //Find farthest point in triangle
vector3 temp_point;
switch(i3) {
case 0:
temp_point = Body.Tri[i2].p1;
case 1:
temp_point = Body.Tri[i2].p2;
case 2:
temp_point = Body.Tri[i2].p3;
}
mo = Spawn("MapSpot", pos + temp_point);
mo2 = Spawn("MapSpot", pos + Body.Tri[i2].normal);
Body.Tri[i2].rad = mo.Distance3D(mo2);
mo.Destroy();
mo2.Destroy();
}
}
Super.PostBeginPlay();
}
Array<class<Actor> > CheckActor; //clear after each implements, cuz this is a variable, not actor. This is CheckActor, they've been checked while nearby triangle.
override void Tick() {
for(int i = 0; i < Body.Tri.Size(); i++) {
Actor mo, mo2; //temp actors
float check_dist; //Tri's check size (or just distance from normal to points)
//Distance from tri's normal to actor
mo = Spawn("MapSpot", pos + vel); //velocity of actor
mo2 = Spawn("MapSpot", pos + Body.Tri[i].normal); //normal's position
check_dist = Body.Tri[i].rad + Distance3D(mo) + 8;
mo.Destroy();
//Find nearest actors to check
ThinkerIterator AF = ThinkerIterator.Create("Actor");
while(mo = Actor(AF.Next())) if(mo2.Distance3D(mo) <= check_dist && mo is "PhysActor" && mo != self) {
CheckActor.Push(mo);
}
mo2.Destroy();
//Finally we are done with implementing CheckActor!
//Now let's move our PhysActor!
if(CheckActor[0] != null) {
for(int i2 = 0; i2 < CheckActor.Size(); i2++) {
let pmo = PhysActor(CheckActor[i2]); //PMO - Physical Main Object :P
console.printf("checking actor %s", pmo.GetClassName());
}
}
//Clear checkactors
CheckActor.Clear();
mo.Destroy();
mo2.Destroy();
}
Super.Tick();
}
}
Code: Select all
126: Body.Tri.Push(tri_temp);
128: Body.type = 0;
131: for(int i2 = 0; i2 < Body.Tri.Size(); i2++) {
163: for(int i = 0; i < Body.Tri.Size(); i++) {
Only because of arrays and classes i stuck with getting that error...
Spoiler: