-
Now i'm confused. What do i have to do? :D
I obv changed that + to *. I dont know how that happened :D
//edit:
After taking a look at my video again i realized something thats weird.
On the third ramp (0.35) the print from
Code:
VectortoAngles(newPos["normal"])
is (330,0,0)
If i set the angles of the object directly to that value its the same as in the video and as you can see its wrong.
If i set it to (0,0,330), its exactly as it should be.
Why the hell is that shit basically mirrored? Is there something that i'm missing there?
-
Maybe BO3 has another coordinate system. Just try to flip the values in script, e.g.:
PHP Code:
tmp= utils\math::orientToNormal(newPos["normal"]+(0.01,0.01,0.01));
tmp = (tmp[2], tmp[1], tmp[0]);
bluePortal.angles = tmp;
-
https://www.youtube.com/watch?v=jRcodiPLwfs
So with:
Code:
newangles = VectortoAngles(newPos["normal"]) + (0,90,0);
orangePortal.angles = (newangles[2],newangles[1],newangles[0]);
Its working as it should. Its flat to the walls and flat to the floor and ramps.
Still weird that somehow x,y,z changed.
With orientToNormal the portal is still rotated into all directions. The values doesnt seem to be correct is you can see in the prints.
Now there are 2 problems left until the portal placement is done.
1. Sometimes the portals are stuck inside of the wall. (Video at: 0.04)
2. For some reason its sometimes not taking the direction that it should. (Video at: 0.25)
You can see that when i place the portal on the ground, its 90° rotated.
Obv. thats only the case if i look in that direction, if i turn myself 90° the Portal is correct.
So it seems like its not using the direction the player is looking at.
-
This should fix your in-wall stuff:
PHP Code:
placeportal(portalmodel)
{
trace = bullettrace(self geteyepos(), self geteyepos() + vectorscale(anglestoforward(self getplayerangles()), 1000), false, undefined);
if(trace["fraction"] < 1)
{
//actually place portal here
portalmodel.origin = trace["origin"] + vectorscale(trace["normal"], 0.01); //put it outside the wall
portalmodel.angles = vectortoangles(trace["normal"]);
return true;
}
return false;
}
-
Everything is working fine now, the only problem thats left, is the rotation of the model while placed on the floor/ceiling.
Is there any chance to rotate the model on the floor with the player angle? (video at 0.25)
-
Just check if normal[2] == 1 || normal[2] == -1
Then use portal.angles = (0, player getplayerangles()[2], 0);