Fix players spawning on top of the ball
This commit is contained in:
parent
d28ba31d74
commit
72c74bbedb
@ -57,21 +57,21 @@ impl Map {
|
|||||||
if let Some(local_player) = &GameManager::singleton().bind().local_player {
|
if let Some(local_player) = &GameManager::singleton().bind().local_player {
|
||||||
let mut node = local_player.instantiate_as::<LocalPlayer>();
|
let mut node = local_player.instantiate_as::<LocalPlayer>();
|
||||||
node.bind_mut().player_id = Some(player_id);
|
node.bind_mut().player_id = Some(player_id);
|
||||||
self.base_mut().add_child(&node);
|
|
||||||
if let Some(transform) = transform {
|
if let Some(transform) = transform {
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_position(transform.location.into());
|
.set_position(transform.location.into());
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_rotation(transform.rotation.into());
|
.set_rotation(transform.rotation.into());
|
||||||
} else {
|
} else {
|
||||||
if let Some(spawner) = &self.spawners.get(team as usize) {
|
if let Some(spawner) = &self.spawners.get(team as usize) {
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_position(spawner.get_global_position());
|
.set_position(spawner.get_position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.base_mut().add_child(&node);
|
||||||
Some(node.into_dyn::<dyn IPlayer>().upcast())
|
Some(node.into_dyn::<dyn IPlayer>().upcast())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -92,21 +92,21 @@ impl Map {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.base_mut().add_child(&node);
|
|
||||||
if let Some(transform) = transform {
|
if let Some(transform) = transform {
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_position(transform.location.into());
|
.set_position(transform.location.into());
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_rotation(transform.rotation.into());
|
.set_rotation(transform.rotation.into());
|
||||||
} else {
|
} else {
|
||||||
if let Some(spawner) = &self.spawners.get(team as usize) {
|
if let Some(spawner) = &self.spawners.get(team as usize) {
|
||||||
node.bind_mut()
|
node.bind_mut()
|
||||||
.base_mut()
|
.base_mut()
|
||||||
.set_global_position(spawner.get_global_position());
|
.set_position(spawner.get_position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.base_mut().add_child(&node);
|
||||||
Some(node.into_dyn::<dyn IPlayer>().upcast())
|
Some(node.into_dyn::<dyn IPlayer>().upcast())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -155,10 +155,10 @@ impl Map {
|
|||||||
ball.bind_mut().dropper = player_id;
|
ball.bind_mut().dropper = player_id;
|
||||||
self.base_mut().add_child(&ball);
|
self.base_mut().add_child(&ball);
|
||||||
if let Some(transform) = transform {
|
if let Some(transform) = transform {
|
||||||
ball.set_global_position(transform.location.into());
|
ball.set_position(transform.location.into());
|
||||||
ball.set_global_rotation(transform.rotation.into());
|
ball.set_rotation(transform.rotation.into());
|
||||||
} else {
|
} else {
|
||||||
ball.set_global_position(ball_spawner.get_global_position());
|
ball.set_position(ball_spawner.get_position());
|
||||||
}
|
}
|
||||||
if let Some(velocity) = velocity {
|
if let Some(velocity) = velocity {
|
||||||
ball.set_linear_velocity(velocity.into());
|
ball.set_linear_velocity(velocity.into());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user