Skip to content

Commit 160bfab

Browse files
committed
Fix boost pad locations
1 parent ff60b4a commit 160bfab

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pytest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import rlviser_py as vis
44
import RocketSim as rs
55

6-
game_mode = rs.GameMode.SOCCAR
6+
game_mode = rs.GameMode.HOOPS
77

88
# Create example arena
99
arena = rs.Arena(game_mode)

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ macro_rules! pynamedmodule {
1818
};
1919
}
2020

21-
pub const BOOST_PADS_LENGTH: usize = 34;
22-
2321
pynamedmodule! {
2422
doc: "rlviser_py is a module for interacting with RLViser from Python",
2523
name: rlviser_py,
@@ -31,13 +29,14 @@ pynamedmodule! {
3129
}
3230

3331
thread_local! {
34-
static BOOST_PAD_LOCATIONS: RefCell<[Vec3; BOOST_PADS_LENGTH]> = RefCell::new([Vec3::ZERO; BOOST_PADS_LENGTH]);
32+
static BOOST_PAD_LOCATIONS: RefCell<Vec<Vec3>> = RefCell::new(Vec::new());
3533
}
3634

3735
/// Set the boost pad locations to send to RLViser in each packet
3836
#[pyfunction]
39-
fn set_boost_pad_locations(locations: [[f32; 3]; BOOST_PADS_LENGTH]) {
37+
fn set_boost_pad_locations(locations: Vec<[f32; 3]>) {
4038
BOOST_PAD_LOCATIONS.with_borrow_mut(|locs| {
39+
locs.resize(locations.len(), Vec3::ZERO);
4140
locs.iter_mut()
4241
.zip(locations)
4342
.for_each(|(rloc, pyloc)| *rloc = Vec3::from_array(pyloc));
@@ -49,7 +48,7 @@ fn render(
4948
tick_count: u64,
5049
tick_rate: f32,
5150
game_mode: u8,
52-
boost_pad_states: [bool; BOOST_PADS_LENGTH],
51+
boost_pad_states: Vec<bool>,
5352
ball: BallState,
5453
cars: Vec<(u32, u8, CarConfig, CarState)>,
5554
) {

0 commit comments

Comments
 (0)