summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/code/m_roll_lib.c294
-rw-r--r--src/overlays/actors/ovl_Airplane/ac_airplane.c8
-rw-r--r--src/overlays/actors/ovl_Ball/ac_ball.c52
-rw-r--r--src/overlays/actors/ovl_Fuusen/ac_fuusen.c2
4 files changed, 325 insertions, 31 deletions
diff --git a/src/code/m_roll_lib.c b/src/code/m_roll_lib.c
new file mode 100644
index 0000000..775f1fc
--- /dev/null
+++ b/src/code/m_roll_lib.c
@@ -0,0 +1,294 @@
+#include "m_roll_lib.h"
+#include "z64math.h"
+#include "m_field_info.h"
+#include "m_field_make.h"
+#include "overlays/gamestates/ovl_play/m_play.h"
+#include "overlays/actors/player_actor/m_player.h"
+#include "m_player_lib.h"
+#include "sys_math_atan.h"
+#include "m_collision_bg.h"
+#include "69E2C0.h"
+#include "macros.h"
+
+void mRlib_spdXZ_to_spdF_Angle(xyz_t* speed, f32* speedf, s16* angle) {
+ f32 x = speed->x;
+ f32 z = speed->z;
+
+ speedf[0] = sqrtf(x * x + z * z);
+ angle[0] = atans_table(z, x);
+}
+
+void mRlib_spdF_Angle_to_spdXZ(xyz_t* speed, f32* speedf, s16* angle) {
+ speed->x = speedf[0] * sin_s(angle[0]);
+ speed->z = speedf[0] * cos_s(angle[0]);
+}
+
+s32 mRlib_position_move_for_sloop(Actor* actor, s_xyz* slopeAngle) {
+ UNUSED s32 pad;
+ f32 y;
+ f32 x;
+ f32 z;
+
+ if (actor->colCheck.colResult.onGround && (slopeAngle->x != 0 || slopeAngle->z != 0)) {
+ x = (actor->velocity.x * ABS(cos_s(slopeAngle->z)));
+ y = actor->velocity.y;
+ z = (actor->velocity.z * ABS(cos_s(slopeAngle->x)));
+
+ actor->world.pos.x += x + actor->colStatus.displacement.x;
+ actor->world.pos.y += y + actor->colStatus.displacement.y;
+ actor->world.pos.z += z + actor->colStatus.displacement.z;
+
+ return TRUE;
+ } else {
+ Actor_position_move(actor);
+ return FALSE;
+ }
+}
+
+s32 mRlib_Get_norm_Clif(Actor* actor, xyz_t* norm) {
+ s16 angles[2];
+ s16 angle;
+ f32 percent;
+ s32 i;
+
+ if (mCoBG_CheckAttribute_BallRolling(angles, &actor->world.pos)) {
+
+ for (i = 0; i < 2; i++) {
+ percent = mCoBG_CheckBallRollingArea(angles[i], &actor->world.pos);
+
+ if (percent > 0.0f && percent < 0.5f) {
+ xyz_t rot;
+ xyz_t pos;
+ angle = angles[i] + DEG_TO_BINANG_ALT2(90.0f);
+ pos = *norm;
+
+ rot.x = sin_s(angle);
+ rot.y = 0.0f;
+ rot.z = cos_s(angle);
+
+ Matrix_RotateVector(DEG_TO_BINANG_ALT4((0.5f - percent) * 80.0f), &rot, 0);
+ Matrix_Position(&pos, norm);
+
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+void mRlib_Roll_Matrix_to_s_xyz(Actor* actor, s_xyz* rot, s16 angle) {
+ MtxF matrix;
+ xyz_t axis;
+
+ axis.x = cos_s(actor->world.rot.y);
+ axis.z = -sin_s(actor->world.rot.y);
+ axis.y = 0.0f;
+
+ Matrix_RotateVector(angle, &axis, 0);
+ Matrix_rotateXYZ(rot->x, rot->y, rot->z, 1);
+ Matrix_get(&matrix);
+ Matrix_to_rotate2_new(&matrix, rot, 0);
+}
+
+s16 mRlib_Get_HitWallAngleY(Actor* actor) {
+ u16 angle = actor->colCheck.wallInfo[0].angleY;
+ u16 angle2;
+ s16 median;
+
+ if (actor->colCheck.colResult.unk3 != 1) {
+ angle2 = actor->colCheck.wallInfo[1].angleY;
+ median = (angle + angle2) >> 1;
+
+ if (ABS(angle - angle2) > 0x8000) {
+ median += 0x8000;
+ }
+ } else {
+ median = angle;
+ }
+
+ return median;
+}
+
+void mRlib_Station_step_modify_to_wall(Actor* actor) {
+ s_xyz angle;
+ f32 z;
+
+ mCoBG_GetBgY_AngleS_FromWpos(&angle, actor->world.pos, 0.0f);
+
+ if (angle.x >= DEG_TO_BINANG_ALT2(45.0f)) {
+ actor->colCheck.colResult.hitWall |= 3;
+ z = FI_UT_WORLDSIZE_Z_F + ((s32)(actor->world.pos.z / FI_UT_WORLDSIZE_Z_F) * FI_UT_WORLDSIZE_Z);
+ actor->colCheck.wallInfo[0].angleY = 0.0f;
+ actor->colCheck.colResult.unk3 = 1;
+ actor->world.pos.z = z;
+ }
+}
+
+s32 mRlib_Set_Position_Check(Actor* actor) {
+ s32 bx;
+ s32 bz;
+ s32 utX;
+ s32 utZ;
+ s32 set;
+ s32 ofsX;
+ s32 ofsZ;
+
+ mFI_Wpos2BkandUtNuminBlock(&bx, &bz, &utX, &utZ, actor->world.pos);
+
+ set = mNpc_CheckNpcSet(bx, bz, utX, utZ);
+ if (set == FALSE) {
+ for (ofsX = -1; ofsX < 2; ofsX++) {
+ for (ofsZ = -1; ofsZ < 2; ofsZ++) {
+ if ((ofsX != 0 || ofsZ != 0) && (utX + ofsX) < UT_X_NUM && (utX + ofsX) > 0 &&
+ (utZ + ofsZ) < UT_Z_NUM && (utZ + ofsZ) > 0) {
+ set = mNpc_CheckNpcSet(bx, bz, utX + ofsX, utZ + ofsZ);
+ }
+
+ if (set == TRUE) {
+ f32 y = actor->world.pos.y;
+
+ mFI_BkandUtNum2CenterWpos(&actor->world.pos, bx, bz, utX + ofsX, utZ + ofsZ);
+ actor->world.pos.y = y;
+
+ return set;
+ }
+ }
+ }
+ }
+
+ return set;
+}
+
+s32 mRlib_HeightGapCheck_And_ReversePos(Actor* actor) {
+ s32 bx;
+ s32 bz;
+ s32 utX;
+ s32 utZ;
+
+ if (mFI_GetPlayerWade() == 2 && mCoBG_ExistHeightGap_KeepAndNow_Detail(actor->world.pos)) {
+ if (mRlib_Set_Position_Check(actor) != FALSE) {
+ actor->velocity.y = 0.0f;
+ } else {
+ mFI_Wpos2BkandUtNuminBlock(&bx, &bz, &utX, &utZ, actor->world.pos);
+
+ if (mNpc_GetMakeUtNuminBlock_hard_area(&utX, &utZ, bx, bz, 0)) {
+ f32 y = actor->world.pos.y;
+
+ mFI_BkandUtNum2CenterWpos(&actor->world.pos, bx, bz, utX, utZ);
+ actor->world.pos.y = y;
+ actor->velocity.y = 0.0f;
+
+ return TRUE;
+ }
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+s32 mRlib_Hole_check(Actor* actor) {
+ u16* unitFG = mFI_GetUnitFG(actor->world.pos);
+
+ if (unitFG != NULL && ((unitFG[0] >= 0x11 && unitFG[0] <= 0x29) || unitFG[0] == 0x5D)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+s32 mRlib_Get_ground_norm_inHole(Actor* actor, xyz_t* norm, f32* dist, s16* angleY, s16* angleRate, f32 rate) {
+ if (mRlib_Hole_check(actor) != FALSE) {
+ xyz_t centerPos;
+
+ mFI_Wpos2UtCenterWpos(&centerPos, actor->world.pos);
+ dist[0] = search_position_distance(&actor->world.pos, &centerPos);
+ angleRate[0] = DEG_TO_BINANG_ALT4((dist[0] * 90.0f) * 0.0325f);
+ angleRate[0] = (angleRate[0] * rate);
+ angleY[0] = atans_table(actor->world.pos.z - centerPos.z, actor->world.pos.x - centerPos.x);
+
+ norm->x = (-cos_s(angleRate[0])) * sin_s(angleY[0]);
+ norm->y = -sin_s(angleRate[0]);
+ norm->z = (-cos_s(angleRate[0])) * cos_s(angleY[0]);
+
+ return TRUE;
+ } else {
+ dist[0] = 0.0f;
+
+ return FALSE;
+ }
+}
+
+s32 mRlib_PSnowmanTouchCheck(const xyz_t* wpos) {
+ if (ABS(wpos->x) < FI_UT_WORLDSIZE_X_F && ABS(wpos->z) < FI_UT_WORLDSIZE_Z_F && ABS(wpos->y) < FI_UT_BASE_SIZE_F) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+s32 mRlib_PSnowmanBreakCheck(Actor* actor, Game_Play* play, f32* speed) {
+ Player* player = get_player_actor_withoutCheck(play);
+ xyz_t posDiff;
+ f32 y = actor->world.pos.y;
+
+ actor->world.pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(actor->world.pos, 0.0f);
+ xyz_t_sub(&actor->world.pos, &player->actor.world.pos, &posDiff);
+ actor->world.pos.y = y;
+
+ if (mRlib_PSnowmanTouchCheck(&posDiff)) {
+ if (Math3d_normalizeXyz_t(&posDiff)) {
+ xyz_t velocity = player->actor.velocity;
+ f32 dist = (posDiff.x * velocity.x) + (posDiff.z * velocity.z);
+
+ if (dist > 0.0f) {
+ speed[0] += dist;
+ } else {
+ add_calc0(speed, 30.0f / 100.0f, 20.0f);
+ }
+ if (speed[0] > 200.0f) {
+ return TRUE;
+ }
+ } else {
+ add_calc0(speed, 30.0f / 100.0f, 20.0f);
+ }
+ } else {
+ add_calc0(speed, 30.0f / 100.0f, 20.0f);
+ }
+ return FALSE;
+}
+
+s32 mRlib_PSnowmanBreakNeckSwing(f32 f0, f32 scale, s16* angleY) {
+ s16 rotX;
+ s16 rotZ;
+ s16 angle;
+
+ if (f0 > 20.0f) {
+ angleY[0] += (s16)((f0 * 40.0f));
+ angle = angleY[0] & 0x7000;
+ rotX = (4.5f * f0) * sin_s(angle);
+ rotZ = (4.5f * f0) * cos_s(angle);
+
+ Matrix_translate(0.0f, -1400.0f * scale, 0.0f, 1);
+ Matrix_rotateXYZ(rotX, 0, rotZ, 1);
+ Matrix_translate(0.0f, 1400.0f * scale, 0.0f, 1);
+ }
+}
+
+s32 mRlib_PSnowman_NormalTalk(Actor* actor, Game_Play* play, f32* speed, void* proc) {
+ if (mDemo_Check(7, actor) == FALSE) {
+ f32 y;
+
+ if (mRlib_PSnowmanBreakCheck(actor, play, speed) != FALSE) {
+ return FALSE;
+ }
+ y = actor->world.pos.y;
+ actor->world.pos.y = mCoBG_GetBgY_AngleS_FromWpos(NULL, actor->world.pos, 0.0f);
+ mDemo_Request(7, actor, proc);
+ actor->world.pos.y = y;
+ } else {
+ add_calc0(speed, 3.0f / 10.0f, 20.0f);
+ }
+
+ return TRUE;
+}
diff --git a/src/overlays/actors/ovl_Airplane/ac_airplane.c b/src/overlays/actors/ovl_Airplane/ac_airplane.c
index 69f2b1b..3b0dcad 100644
--- a/src/overlays/actors/ovl_Airplane/ac_airplane.c
+++ b/src/overlays/actors/ovl_Airplane/ac_airplane.c
@@ -78,14 +78,14 @@ void aAp_RubberMove(f32* pValue, f32 target, f32 step) {
}
void aAp_FallByWall(Airplane* this) {
- if (this->actor.colResult.hitWall != 0) {
+ if (this->actor.colCheck.colResult.hitWall != 0) {
this->state = Ap_STATE_FALL_FLY_MOVE;
}
}
void aAp_GroundFriction(Airplane* this, Game_Play* game_play) {
- if (this->actor.colResult.onGround) {
+ if (this->actor.colCheck.colResult.onGround) {
aAp_RubberMove(&this->speed, 0.0f, 0.6f);
if (this->speed < 1.0f) {
this->state = Ap_STATE_STOP_FLY_MOVE;
@@ -201,7 +201,7 @@ void aAp_FallFlyMove(Airplane* this, Game_Play* game_play) {
aAp_RubberMove(&this->xRot, 60.0f, 0.04f);
aAp_RubberMove(&this->speed, 5.0f, 0.02f);
this->actor.world.pos.y -= 0.15f;
- if (this->actor.colResult.onGround) {
+ if (this->actor.colCheck.colResult.onGround) {
common_data.clip.unk_090->unk_00(1, this->actor.world.pos, 1, this->actor.world.rot.y, game_play,
this->actor.fgName, 0, 8);
this->state = Ap_STATE_STOP_FLY_MOVE;
@@ -212,7 +212,7 @@ void aAp_FallFlyMove2(Airplane* this, Game_Play* game_play) {
aAp_RubberMove(&this->xRot, 70.0f, 0.15f);
aAp_RubberMove(&this->speed, 10.0f, 0.02f);
this->actor.world.pos.y -= 0.15f;
- if (this->actor.colResult.onGround) {
+ if (this->actor.colCheck.colResult.onGround) {
common_data.clip.unk_090->unk_00(1, this->actor.world.pos, 1, this->actor.world.rot.y, game_play,
this->actor.fgName, 0, 8);
this->state = Ap_STATE_STOP_FLY_MOVE;
diff --git a/src/overlays/actors/ovl_Ball/ac_ball.c b/src/overlays/actors/ovl_Ball/ac_ball.c
index ba0f82e..87879d9 100644
--- a/src/overlays/actors/ovl_Ball/ac_ball.c
+++ b/src/overlays/actors/ovl_Ball/ac_ball.c
@@ -7,7 +7,7 @@
#include "libc/math.h"
#include "m_npc.h"
#include "audio.h"
-#include "6F2150.h"
+#include "m_roll_lib.h"
#include "m_field_info.h"
#include "sys_math_atan.h"
#include "m_player_lib.h"
@@ -227,7 +227,7 @@ void aBALL_position_move(Ball* this) {
mCoBG_GetBgY_AngleS_FromWpos(&slopeAngle, this->actor.world.pos, 0.0f);
- if (this->actor.colResult.onGround || this->actor.colResult.inWater) {
+ if (this->actor.colCheck.colResult.onGround || this->actor.colCheck.colResult.inWater) {
chase_f(&this->actor.speed, this->maxSpeed, this->acceleration);
}
@@ -258,7 +258,7 @@ void aBALL_BGcheck(Ball* this) {
yVelocity = this->actor.velocity.y;
if ((this->process == aBALL_process_air_water) || (this->process == aBALL_process_ground_water) ||
- (this->actor.colResult.unk5 == 0xB)) {
+ (this->actor.colCheck.colResult.unk5 == 0xB)) {
mCoBG_BgCheckControll(&this->bgPos, &this->actor, 12.0f, -12.0f, 0, 1, 0);
this->actor.world.pos.x += this->bgPos.x;
this->actor.world.pos.z += this->bgPos.z;
@@ -268,13 +268,13 @@ void aBALL_BGcheck(Ball* this) {
}
if (((this->process == aBALL_process_air) || (this->process == aBALL_process_air_water)) &&
- this->actor.colResult.onGround) {
+ this->actor.colCheck.colResult.onGround) {
if (this->bounceTimer < 3) {
do {
this->bounceTimer++;
} while (0);
- if (this->actor.colResult.inWater) {
+ if (this->actor.colCheck.colResult.inWater) {
this->actor.velocity.y = 0.2f;
} else {
this->actor.velocity.y = -yVelocity * 0.7f;
@@ -282,7 +282,7 @@ void aBALL_BGcheck(Ball* this) {
}
}
- hitWall = this->actor.colResult.hitWall;
+ hitWall = this->actor.colCheck.colResult.hitWall;
if (hitWall & 1) {
wallAngle = mRlib_Get_HitWallAngleY(&this->actor);
rot = this->actor.world.rot.y - wallAngle - 0x8000;
@@ -363,7 +363,7 @@ void aBALL_OBJcheck(Ball* this) {
ballSpeed = sqrtf(SQ(newXVelocity) + SQ(newZVelocity));
ballSpeed = CLAMP_MAX(ballSpeed, 11.0f);
- if (this->actor.colResult.onGround) {
+ if (this->actor.colCheck.colResult.onGround) {
f32 speedFactor;
s16 verticalAngle;
@@ -409,7 +409,7 @@ void aBALL_OBJcheck(Ball* this) {
}
void aBALL_House_Tree_Rev_Check(Ball* this) {
- if (mRlib_HeightGapCheck_And_ReversePos() != 1) {
+ if (mRlib_HeightGapCheck_And_ReversePos(&this->actor) != 1) {
this->unk_208 |= BALL_208_FLAG_1;
Actor_delete(&this->actor);
}
@@ -435,13 +435,13 @@ void aBALL_process_air(Ball* this, Game_Play* game_play) {
this->actor.terminalVelocity = -20.0f;
this->actor.gravity = 0.6f;
this->speed = this->actor.speed;
- if (this->actor.colResult.onGround) {
- if (this->actor.colResult.inWater) {
+ if (this->actor.colCheck.colResult.onGround) {
+ if (this->actor.colCheck.colResult.inWater) {
aBALL_process_ground_water_init(this, game_play);
} else {
aBALL_process_ground_init(this, game_play);
}
- } else if (this->actor.colResult.inWater) {
+ } else if (this->actor.colCheck.colResult.inWater) {
aBALL_process_air_water_init(this, game_play);
}
}
@@ -518,20 +518,20 @@ void aBALL_process_ground(Ball* this, Game_Play* game_play) {
this->actor.terminalVelocity = -20.0f;
this->actor.gravity = 0.6f;
this->speed = this->actor.speed;
- if (this->actor.colResult.inWater || this->actor.colResult.unk5 == 0xB) {
- if (this->actor.colResult.onGround) {
+ if (this->actor.colCheck.colResult.inWater || this->actor.colCheck.colResult.unk5 == 0xB) {
+ if (this->actor.colCheck.colResult.onGround) {
aBALL_process_ground_water_init(this, game_play);
} else {
this->bounceTimer = 0;
aBALL_process_air_water_init(this, game_play);
}
- } else if (!this->actor.colResult.onGround) {
+ } else if (!this->actor.colCheck.colResult.onGround) {
this->bounceTimer = 0;
aBALL_process_air_init(this, game_play);
return;
}
- if (!(game_play->state.frameCounter & 7) && this->actor.colResult.unk5 == 9) {
+ if (!(game_play->state.frameCounter & 7) && this->actor.colCheck.colResult.unk5 == 9) {
if (this->actor.speed > 1.0f) {
if (this->actor.speed > 4.0f) {
@@ -566,7 +566,7 @@ void aBALL_set_spd_relations_in_water(Ball* this, Game_Play* game_play) {
waterHeight = mCoBG_GetWaterHeight_File(this->actor.world.pos, "../ac_ball.c", 949);
add_calc0(&this->height, 0.5f, 100.0f);
- mCoBG_GetWaterFlow(&flowPos, this->actor.colResult.unk5);
+ mCoBG_GetWaterFlow(&flowPos, this->actor.colCheck.colResult.unk5);
yRot = atans_table(flowPos.z, flowPos.x);
yDiffAngle = ABS((s16)(this->actor.world.rot.y - yRot));
@@ -612,13 +612,13 @@ void aBALL_process_air_water(Ball* this, Game_Play* game_play) {
common_data.clip.unk_0A8->unk_0C(&this->actor.world.pos, 20.0f, 1);
}
- if (this->actor.colResult.onGround) {
- if (this->actor.colResult.inWater) {
+ if (this->actor.colCheck.colResult.onGround) {
+ if (this->actor.colCheck.colResult.inWater) {
aBALL_process_ground_water_init(this, game_play);
- } else if (this->actor.colResult.unk5 != 0xB) {
+ } else if (this->actor.colCheck.colResult.unk5 != 0xB) {
aBALL_process_ground_init(this, game_play);
}
- } else if (!this->actor.colResult.inWater) {
+ } else if (!this->actor.colCheck.colResult.inWater) {
aBALL_process_air_init(this, game_play);
}
}
@@ -634,7 +634,7 @@ void aBALL_process_ground_water(Ball* this, Game_Play* game_play) {
u32 unitAttribute;
xyz_t* bgPos;
- unitAttribute = this->actor.colResult.unk5;
+ unitAttribute = this->actor.colCheck.colResult.unk5;
aBALL_set_spd_relations_in_water(this, game_play);
this->speed = this->actor.speed;
@@ -642,11 +642,11 @@ void aBALL_process_ground_water(Ball* this, Game_Play* game_play) {
if (common_data.clip.unk_0A8 != NULL) {
common_data.clip.unk_0A8->unk_0C(&this->actor.world.pos, 20.0f, 1);
}
- if (this->actor.colResult.onGround) {
- if (!this->actor.colResult.inWater && (unitAttribute != 0xB) && (unitAttribute != 0x16)) {
+ if (this->actor.colCheck.colResult.onGround) {
+ if (!this->actor.colCheck.colResult.inWater && (unitAttribute != 0xB) && (unitAttribute != 0x16)) {
aBALL_process_ground_init(this, game_play);
}
- } else if (!this->actor.colResult.inWater) {
+ } else if (!this->actor.colCheck.colResult.inWater) {
aBALL_process_air_init(this, game_play);
} else {
aBALL_process_air_water_init(this, game_play);
@@ -725,7 +725,7 @@ void aBALL_status_check(Ball* this, Game_Play* game_play) {
}
}
if (!(this->unk_208 & BALL_208_FLAG_1)) {
- if (this->actor.colResult.inWater) {
+ if (this->actor.colCheck.colResult.inWater) {
sAdo_OngenTrgStart(0x27, &this->actor.world.pos);
this->unk_208 |= BALL_208_FLAG_1;
if (common_data.clip.unk_0A8 != NULL) {
@@ -748,7 +748,7 @@ void aBALL_actor_move(Actor* thisx, Game_Play* game_play) {
aBALL_House_Tree_Rev_Check(this);
if (!((this->actor.flags) & ACTOR_FLAG_40)) {
- if ((this->actor.colResult.inWater) || (this->unk_208 & BALL_208_FLAG_2)) {
+ if ((this->actor.colCheck.colResult.inWater) || (this->unk_208 & BALL_208_FLAG_2)) {
Actor_delete(&this->actor);
}
if (this->actor.speed == 0.0f) {
diff --git a/src/overlays/actors/ovl_Fuusen/ac_fuusen.c b/src/overlays/actors/ovl_Fuusen/ac_fuusen.c
index 937a47b..e4dc970 100644
--- a/src/overlays/actors/ovl_Fuusen/ac_fuusen.c
+++ b/src/overlays/actors/ovl_Fuusen/ac_fuusen.c
@@ -210,7 +210,7 @@ void aFSN_moving(Actor* thisx, Game_Play* game_play) {
Game_play_Projection_Trans(game_play, &this->actor.world.pos, &screenPos);
if (!(screenPos.x < -40.0f) && !(screenPos.x > 360.0f) && !(screenPos.y < -40.0f) && !(screenPos.y > 280.0f)) {
mCoBG_BgCheckControll(NULL, &this->actor, 12.0f, 0, 0, 0, 0);
- if (this->actor.colResult.hitWall & 1 || this->actor.colResult.unk1 & 1) {
+ if (this->actor.colCheck.colResult.hitWall & 1 || this->actor.colCheck.colResult.unk1 & 1) {
this->heightOffset += 0.01f;
if (this->heightOffset >= 300.0f) {
this->heightOffset = 300.0f;