mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Increase entity vs entity repulsion factor, add check to ensure entities don't collide with themselves, fix possession projectiles not working on entities in the same group
This commit is contained in:
parent
ca2aad0080
commit
017d4a3c16
@ -176,6 +176,7 @@ impl Tool {
|
||||
],
|
||||
time_left: Duration::from_secs(15),
|
||||
owner: None,
|
||||
ignore_group: true,
|
||||
},
|
||||
projectile_body: Body::Object(object::Body::Arrow),
|
||||
projectile_light: None,
|
||||
@ -274,6 +275,7 @@ impl Tool {
|
||||
],
|
||||
time_left: Duration::from_secs(20),
|
||||
owner: None,
|
||||
ignore_group: true,
|
||||
},
|
||||
projectile_body: Body::Object(object::Body::BoltFire),
|
||||
projectile_light: Some(LightEmitter {
|
||||
@ -303,6 +305,7 @@ impl Tool {
|
||||
],
|
||||
time_left: Duration::from_secs(20),
|
||||
owner: None,
|
||||
ignore_group: true,
|
||||
},
|
||||
projectile_body: Body::Object(object::Body::BoltFireBig),
|
||||
projectile_light: Some(LightEmitter {
|
||||
@ -350,6 +353,7 @@ impl Tool {
|
||||
],
|
||||
time_left: Duration::from_secs(10),
|
||||
owner: None,
|
||||
ignore_group: false,
|
||||
},
|
||||
projectile_body: Body::Object(object::Body::ArrowSnake),
|
||||
projectile_light: Some(LightEmitter {
|
||||
|
@ -23,6 +23,9 @@ pub struct Projectile {
|
||||
/// Time left until the projectile will despawn
|
||||
pub time_left: Duration,
|
||||
pub owner: Option<Uid>,
|
||||
/// Whether projectile collides with entities in the same group as its
|
||||
/// owner
|
||||
pub ignore_group: bool,
|
||||
}
|
||||
|
||||
impl Component for Projectile {
|
||||
|
@ -136,6 +136,7 @@ impl CharacterBehavior for Data {
|
||||
],
|
||||
time_left: Duration::from_secs(15),
|
||||
owner: None,
|
||||
ignore_group: true,
|
||||
};
|
||||
projectile.owner = Some(*data.uid);
|
||||
update.server_events.push_front(ServerEvent::Shoot {
|
||||
|
@ -158,6 +158,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
// Group to ignore collisions with
|
||||
let ignore_group = projectile
|
||||
.filter(|p| p.ignore_group)
|
||||
.and_then(|p| p.owner)
|
||||
.and_then(|uid| uid_allocator.retrieve_entity_internal(uid.into()))
|
||||
.and_then(|e| groups.get(e));
|
||||
@ -185,7 +186,7 @@ impl<'a> System<'a> for Sys {
|
||||
)
|
||||
.join()
|
||||
{
|
||||
if ignore_group.is_some() && ignore_group == group {
|
||||
if entity == entity_other || (ignore_group.is_some() && ignore_group == group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -237,7 +238,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
if diff.magnitude_squared() > 0.0 {
|
||||
let force = 40.0 * (collision_dist - diff.magnitude()) * mass_other
|
||||
let force = 400.0 * (collision_dist - diff.magnitude()) * mass_other
|
||||
/ (mass + mass_other);
|
||||
|
||||
vel_delta += Vec3::from(diff.normalized()) * force * step_delta;
|
||||
|
Loading…
Reference in New Issue
Block a user