Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SlopedThing : Candelabra
- {
- Default
- {
- +FLATSPRITE;
- //+ROLLCENTER;
- }
- private void SetToSlope(double dang)
- {
- vector3 fnormal = CurSector.floorplane.normal;
- vector2 fnormalp1 = (fnormal.x != 0 || fnormal.y != 0) ? (fnormal.x, fnormal.y).Unit() : (0, 0);
- vector2 fnormalp2 = ((fnormal.x, fnormal.y).Length(), fnormal.z);
- double fang = atan2(fnormalp1.y, fnormalp1.x); // floor angle (not pitch!)
- double fpitch = atan2(fnormalp2.x, fnormalp2.y); // floor pitch
- double ddiff1 = cos(fang-(dang-90));
- double ddiff2 = cos(fang-dang);
- self.pitch = fpitch*ddiff2-90;
- self.roll = -fpitch*ddiff1;
- self.angle = dang;
- }
- override void PostBeginPlay()
- {
- Super.PostBeginPlay();
- }
- override void Tick()
- {
- double dang = (level.time*3)%360;
- //dang = 45;
- SetToSlope(dang);
- Super.Tick();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement