Struct rl_ball_sym::simulation::ball::Ball
source · [−]pub struct Ball {
pub time: f32,
pub location: Vec3A,
pub velocity: Vec3A,
pub angular_velocity: Vec3A,
pub radius: f32,
pub collision_radius: f32,
pub moi: f32,
}
Expand description
Represents the game’s ball
Fields
time: f32
Game time of the ball
location: Vec3A
Position of the ball
velocity: Vec3A
Linear velocity of the ball
angular_velocity: Vec3A
Rotational velocity of the ball
radius: f32
Size of the ball
collision_radius: f32
Size of the ball for collisions
moi: f32
Momemnt of inertia of the ball
Implementations
sourceimpl Ball
impl Ball
sourcepub fn initialize_soccar() -> Self
pub fn initialize_soccar() -> Self
Sets the default values for a soccar ball
sourcepub fn initialize_hoops() -> Self
pub fn initialize_hoops() -> Self
Sets the default values for a hoops ball
sourcepub fn initialize_dropshot() -> Self
pub fn initialize_dropshot() -> Self
Sets the default values for a dropshot ball
sourcepub fn initialize(&mut self)
pub fn initialize(&mut self)
Sets a value location and calculates the moi
sourcepub fn calculate_moi(&mut self)
pub fn calculate_moi(&mut self)
Calculates the moment of inertia of the ball
sourcepub fn update(
&mut self,
time: f32,
location: Vec3A,
velocity: Vec3A,
angular_velocity: Vec3A
)
pub fn update(
&mut self,
time: f32,
location: Vec3A,
velocity: Vec3A,
angular_velocity: Vec3A
)
Updates the ball with everything that changes from game tick to game tick
sourcepub fn step(game: &mut Game, dt: f32)
pub fn step(game: &mut Game, dt: f32)
Simulate the ball for one game tick
dt
- The delta time (game tick length)
sourcepub fn get_ball_prediction_struct_for_time(
game: &mut Game,
time: &f32
) -> BallPrediction
pub fn get_ball_prediction_struct_for_time(
game: &mut Game,
time: &f32
) -> BallPrediction
Simulate the ball for a given amount of time
sourcepub fn get_ball_prediction_struct(game: &mut Game) -> BallPrediction
pub fn get_ball_prediction_struct(game: &mut Game) -> BallPrediction
Simulate the ball for the stand amount of time
sourcepub fn get_ball_prediction_struct_for_slices(
game: &mut Game,
num_slices: usize
) -> BallPrediction
pub fn get_ball_prediction_struct_for_slices(
game: &mut Game,
num_slices: usize
) -> BallPrediction
Simulate the ball for a given amount of ticks
Trait Implementations
impl Copy for Ball
Auto Trait Implementations
impl RefUnwindSafe for Ball
impl Send for Ball
impl Sync for Ball
impl Unpin for Ball
impl UnwindSafe for Ball
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more