Made the up-angle relative to the pitch of the kart configurable.
It now defaults to 15 degrees (it was 30 degrees, but accidentally a hard coded value of 15 was committed in r6110). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6119 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
<center gravity-shift="0 0.3 0"/>
|
||||
|
||||
<!-- Camera: Distance between kart and camera. -->
|
||||
<camera distance="1.5"/>
|
||||
<camera distance="1.5" up-angle="15"/>
|
||||
|
||||
<!-- If a kart starts within the specified time after 'go',
|
||||
it receives the corresponding bonus from 'boost'. Those
|
||||
@@ -261,7 +261,14 @@
|
||||
<!-- Kart-specific explosion parameters. Height: how high this
|
||||
this kart is being pushed in the sky by an explosion.
|
||||
Time: how long it takes before the kart can drive again. -->
|
||||
<explosion time="2" radius="5" />
|
||||
<explosion time="2" radius="5" />
|
||||
<!-- Kart-specific settings used by the AI.
|
||||
steering-variation: make each kart steer towards slightly
|
||||
different driveline points, so that AI don't create trains.
|
||||
Maximum value should be 1 (steer towards left/right side
|
||||
of driveline), 0 means exactly towards quad center point.
|
||||
Depending on kart id karts will aim at different points.-->
|
||||
<ai steering-variation="0.5" />
|
||||
|
||||
</general-kart-defaults>
|
||||
</config>
|
||||
|
||||
@@ -296,7 +296,8 @@ void Camera::computeNormalCameraPosition(Vec3 *wanted_position,
|
||||
float dampened_steer = fabsf(steering) * steering;
|
||||
float angle_around = m_kart->getHeading()
|
||||
+ m_rotation_range * dampened_steer * 0.5f;
|
||||
float angle_up = m_kart->getPitch() + 15.0f*DEGREE_TO_RAD;
|
||||
float angle_up = m_kart->getPitch()
|
||||
+ m_kart->getKartProperties()->getCameraUpAngle();
|
||||
|
||||
wanted_position->setX(-sin(angle_around));
|
||||
wanted_position->setY( sin(angle_up) );
|
||||
@@ -346,7 +347,8 @@ void Camera::update(float dt)
|
||||
{
|
||||
wanted_target.setY(wanted_target.getY()+ 0.75f);
|
||||
float angle_around = m_kart->getHeading();
|
||||
float angle_up = m_kart->getPitch() + 30.0f*DEGREE_TO_RAD;
|
||||
float angle_up = m_kart->getPitch()
|
||||
+ m_kart->getKartProperties()->getCameraUpAngle();
|
||||
wanted_position.setX( sin(angle_around));
|
||||
wanted_position.setY( sin(angle_up) );
|
||||
wanted_position.setZ( cos(angle_around));
|
||||
@@ -436,7 +438,8 @@ void Camera::handleEndCamera(float dt)
|
||||
//+ m_rotation_range * m_kart->getSteerPercent()
|
||||
//* m_kart->getSkidding()
|
||||
;
|
||||
float angle_up = m_kart->getPitch() + 30.0f*DEGREE_TO_RAD;
|
||||
float angle_up = m_kart->getPitch()
|
||||
+ m_kart->getKartProperties()->getCameraUpAngle();
|
||||
Vec3 wanted_position;
|
||||
wanted_position.setX( sin(angle_around));
|
||||
wanted_position.setY( sin(angle_up) );
|
||||
|
||||
@@ -77,9 +77,9 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
m_skid_decrease = m_skid_increase = m_skid_visual = m_skid_max =
|
||||
m_slipstream_length = m_slipstream_collect_time =
|
||||
m_slipstream_use_time = m_slipstream_add_power =
|
||||
m_slipstream_min_speed = m_camera_distance =
|
||||
m_slipstream_min_speed = m_camera_distance = m_camera_up_angle =
|
||||
m_rescue_time = m_rescue_height = m_explosion_time =
|
||||
m_explosion_radius = UNDEFINED;
|
||||
m_explosion_radius = m_ai_steering_variation = UNDEFINED;
|
||||
m_gravity_center_shift = Vec3(UNDEFINED);
|
||||
m_has_skidmarks = true;
|
||||
m_version = 0;
|
||||
@@ -236,6 +236,10 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
explosion_node->get("radius", &m_explosion_radius);
|
||||
}
|
||||
|
||||
if(const XMLNode *ai_node = root->getNode("ai"))
|
||||
{
|
||||
ai_node->get("steering-variation", &m_ai_steering_variation );
|
||||
}
|
||||
if(const XMLNode *skid_node = root->getNode("skid"))
|
||||
{
|
||||
skid_node->get("increase", &m_skid_increase );
|
||||
@@ -378,7 +382,11 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
}
|
||||
|
||||
if(const XMLNode *camera_node= root->getNode("camera"))
|
||||
{
|
||||
camera_node->get("distance", &m_camera_distance);
|
||||
camera_node->get("up-angle", &m_camera_up_angle);
|
||||
m_camera_up_angle *= DEGREE_TO_RAD;
|
||||
}
|
||||
|
||||
if(const XMLNode *startup_node= root->getNode("startup"))
|
||||
{
|
||||
@@ -501,6 +509,7 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
CHECK_NEG(m_slipstream_add_power, "slipstream add-power" );
|
||||
CHECK_NEG(m_slipstream_min_speed, "slipstream min-speed" );
|
||||
CHECK_NEG(m_camera_distance, "camera distance" );
|
||||
CHECK_NEG(m_camera_up_angle, "camera up-angle" );
|
||||
CHECK_NEG(m_nitro_power_boost, "nitro power-boost" );
|
||||
CHECK_NEG(m_nitro_consumption, "nitro consumption" );
|
||||
CHECK_NEG(m_nitro_big_container, "nitro big-container" );
|
||||
@@ -510,6 +519,7 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
CHECK_NEG(m_rescue_vert_offset, "rescue vert-offset" );
|
||||
CHECK_NEG(m_explosion_time, "explosion time" );
|
||||
CHECK_NEG(m_explosion_radius, "explosion radius" );
|
||||
CHECK_NEG(m_ai_steering_variation, "ai steering-variation" );
|
||||
|
||||
} // checkAllSet
|
||||
|
||||
|
||||
@@ -193,16 +193,25 @@ private:
|
||||
float m_time_till_max_skid; /**< Time till maximum skidding is
|
||||
* reached. */
|
||||
bool m_has_skidmarks; /**< Kart leaves skid marks. */
|
||||
/** Make the AI to steer at slightly different points to make it less
|
||||
* likely that the AI creates 'trains' - the kart behind getting
|
||||
* slipstream. The variation should be a value between 0 (no variation,
|
||||
* all karts steer to the same driveline points) and 1 (karts will aim
|
||||
* all the way to the very edge of the drivelines). */
|
||||
float m_ai_steering_variation;
|
||||
|
||||
float m_camera_distance; /**< Distance of normal camera from kart. */
|
||||
float m_camera_distance; /**< Distance of normal camera from kart.*/
|
||||
float m_camera_up_angle; /**< Up angle of the camera in relation to
|
||||
the pitch of the kart. */
|
||||
|
||||
/** The following two vectors define at what ratio of the maximum speed what
|
||||
* gear is selected. E.g. 0.25 means: if speed <=0.25*maxSpeed --> gear 1,
|
||||
* 0.5 means: if speed <=0.5 *maxSpeed --> gear 2
|
||||
* The next vector contains the increase in max power (to simulate different
|
||||
* gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1 */
|
||||
std::vector<float> m_gear_switch_ratio,
|
||||
m_gear_power_increase;
|
||||
* 0.5 means: if speed <=0.5 *maxSpeed --> gear 2 */
|
||||
std::vector<float> m_gear_switch_ratio;
|
||||
/** This vector contains the increase in max power (to simulate different
|
||||
* gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1. See
|
||||
m_gear_switch_ratio). */
|
||||
std::vector<float> m_gear_power_increase;
|
||||
|
||||
/** If the kart starts within the specified time at index I after 'go',
|
||||
* it receives the speed boost from m_startup_boost[I]. */
|
||||
@@ -433,6 +442,12 @@ public:
|
||||
/** Returns distance between kart and camera. */
|
||||
float getCameraDistance () const {return m_camera_distance; }
|
||||
|
||||
/** Returns the angle the camera has relative to the pitch of the kart. */
|
||||
float getCameraUpAngle () const {return m_camera_up_angle; }
|
||||
|
||||
/** Returns AI steering variation value. */
|
||||
float getAISteeringVariation () const {return m_ai_steering_variation; }
|
||||
|
||||
/** Returns the full path where the files for this kart are stored. */
|
||||
const std::string& getKartDir () const {return m_root; }
|
||||
float getStartupBoost() const;
|
||||
|
||||
Reference in New Issue
Block a user