1#include "ObjectDokan.hh"
3#include "game/field/CollisionDirector.hh"
5#include "game/kart/KartCollide.hh"
13ObjectDokan::~ObjectDokan() =
default;
16void ObjectDokan::init() {
21void ObjectDokan::calc() {
22 constexpr f32 ACCEL = 2.0f;
28 m_velocity.y -= ACCEL;
36void ObjectDokan::calcCollisionTransform() {
37 if (m_id == ObjectId::DokanSFC) {
38 ObjectCollidable::calcCollisionTransform();
43 mat.
setBase(3, mat.translation() + EGG::Vector3f::ey * 300.0f);
44 m_collision->transform(mat, m_scale, getCollisionTranslation());
50 Kart::Reaction reactionOnKart, Kart::Reaction reactionOnObj,
EGG::Vector3f & ) {
51 constexpr f32 INITIAL_VELOCITY = 100.0f;
53 if (reactionOnObj == Kart::Reaction::UNK_3 || reactionOnObj == Kart::Reaction::UNK_5) {
56 m_velocity = INITIAL_VELOCITY * EGG::Vector3f::ey;
60 return reactionOnKart;
64void ObjectDokan::calcFloor() {
65 constexpr f32 PIPE_RADIUS = 100.0f;
66 constexpr f32 PIPE_SQRT_RADIUS = 10.0f;
67 constexpr f32 ACCELERATION = 0.2f;
69 CollisionInfo colInfo;
74 if (!CollisionDirector::Instance()->checkSphereFull(PIPE_RADIUS, pos, EGG::Vector3f::inf,
75 KCL_TYPE_64EBDFFF, &colInfo, &typeMask, 0)) {
80 m_pos.y += colInfo.tangentOff.y;
83 m_velocity.y *= -ACCELERATION;
85 m_pos.y += colInfo.tangentOff.y;
87 if (m_velocity.length() < ACCELERATION * PIPE_SQRT_RADIUS) {
#define KCL_TYPE_FLOOR
0x20E80FFF - Any KCL that the player or items can drive/land on.
void setBase(size_t col, const Vector3f &base)
Sets one column of a matrix.
The highest level abstraction for a kart.