forked from StrafesNET/strafe-client
physics: rework jumping and boosters
This commit is contained in:
parent
7996df532e
commit
165c38a06b
30
Cargo.lock
generated
30
Cargo.lock
generated
@ -326,9 +326,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.7"
|
version = "1.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc"
|
checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
@ -1890,7 +1890,7 @@ dependencies = [
|
|||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pollster",
|
"pollster",
|
||||||
"strafesnet_bsp_loader",
|
"strafesnet_bsp_loader",
|
||||||
"strafesnet_common",
|
"strafesnet_common 0.3.0",
|
||||||
"strafesnet_deferred_loader",
|
"strafesnet_deferred_loader",
|
||||||
"strafesnet_rbx_loader",
|
"strafesnet_rbx_loader",
|
||||||
"strafesnet_snf",
|
"strafesnet_snf",
|
||||||
@ -1905,7 +1905,7 @@ source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
|||||||
checksum = "6d4af68c422b5f57febbaa218f44ba02d413fd25e84afff9e45e557a8caee2ce"
|
checksum = "6d4af68c422b5f57febbaa218f44ba02d413fd25e84afff9e45e557a8caee2ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"strafesnet_common",
|
"strafesnet_common 0.2.3",
|
||||||
"vbsp",
|
"vbsp",
|
||||||
"vmdl",
|
"vmdl",
|
||||||
]
|
]
|
||||||
@ -1921,6 +1921,18 @@ dependencies = [
|
|||||||
"id",
|
"id",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strafesnet_common"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
|
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"glam",
|
||||||
|
"id",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_deferred_loader"
|
name = "strafesnet_deferred_loader"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@ -1928,7 +1940,7 @@ source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
|||||||
checksum = "c3891dcbdbc20b03cf561786b810e839ae7c11dd8810fd005f2474805ee9cccc"
|
checksum = "c3891dcbdbc20b03cf561786b810e839ae7c11dd8810fd005f2474805ee9cccc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy-regex",
|
"lazy-regex",
|
||||||
"strafesnet_common",
|
"strafesnet_common 0.2.3",
|
||||||
"vbsp",
|
"vbsp",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1946,18 +1958,18 @@ dependencies = [
|
|||||||
"rbx_mesh",
|
"rbx_mesh",
|
||||||
"rbx_reflection_database",
|
"rbx_reflection_database",
|
||||||
"rbx_xml",
|
"rbx_xml",
|
||||||
"strafesnet_common",
|
"strafesnet_common 0.2.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_snf"
|
name = "strafesnet_snf"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "78479f73437a3f10230efd2304be0f3ef30dff98c54d93613ed1621bfd6a7da6"
|
checksum = "d12fc351b2af5fd7a8183175d55ac43e21eb8fd1f76cc70cd4713c0d1a556c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"binrw 0.14.0",
|
"binrw 0.14.0",
|
||||||
"id",
|
"id",
|
||||||
"strafesnet_common",
|
"strafesnet_common 0.3.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -23,10 +23,10 @@ id = { version = "0.1.0", registry = "strafesnet" }
|
|||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
pollster = "0.3.0"
|
pollster = "0.3.0"
|
||||||
strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet", optional = true }
|
strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet", optional = true }
|
||||||
strafesnet_common = { version = "0.2.1", registry = "strafesnet" }
|
strafesnet_common = { version = "0.3.0", registry = "strafesnet" }
|
||||||
strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true }
|
strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true }
|
||||||
strafesnet_rbx_loader = { version = "0.3.2", registry = "strafesnet", optional = true }
|
strafesnet_rbx_loader = { version = "0.3.2", registry = "strafesnet", optional = true }
|
||||||
strafesnet_snf = { version = "0.1.0", registry = "strafesnet", optional = true }
|
strafesnet_snf = { version = "0.1.2", registry = "strafesnet", optional = true }
|
||||||
wgpu = "22.0.0"
|
wgpu = "22.0.0"
|
||||||
winit = "0.30.4"
|
winit = "0.30.4"
|
||||||
|
|
||||||
|
@ -1325,25 +1325,10 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
|
|||||||
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
||||||
run_teleport_behaviour(&general.wormhole,&data.models,mode,&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
run_teleport_behaviour(&general.wormhole,&data.models,mode,&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
||||||
}
|
}
|
||||||
match &general.booster{
|
|
||||||
Some(booster)=>{
|
|
||||||
//DELETE THIS when boosters get converted to height machines
|
|
||||||
match booster{
|
|
||||||
//&gameplay_attributes::Booster::Affine(transform)=>v=transform.transform_point3(v),
|
|
||||||
&gameplay_attributes::Booster::Velocity(velocity)=>{
|
|
||||||
let boosted_velocity=state.body.velocity+velocity;
|
|
||||||
//fall through boosters
|
|
||||||
state.cull_velocity(data,boosted_velocity);
|
|
||||||
},
|
|
||||||
&gameplay_attributes::Booster::Energy{direction: _,energy: _}=>todo!(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
None=>(),
|
|
||||||
}
|
|
||||||
if state.style.get_control(Controls::Jump,state.input_state.controls){
|
if state.style.get_control(Controls::Jump,state.input_state.controls){
|
||||||
if let (Some(jump_settings),Some(walk_state))=(&state.style.jump,state.move_state.get_walk_state()){
|
if let (Some(jump_settings),Some(walk_state))=(&state.style.jump,state.move_state.get_walk_state()){
|
||||||
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
|
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
|
||||||
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity);
|
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity,general.booster.as_ref());
|
||||||
state.cull_velocity(data,jumped_velocity);
|
state.cull_velocity(data,jumped_velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1369,6 +1354,10 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
|
|||||||
(PhysicsCollisionAttributes::Intersect{intersecting:_,general},Collision::Intersect(_intersect))=>{
|
(PhysicsCollisionAttributes::Intersect{intersecting:_,general},Collision::Intersect(_intersect))=>{
|
||||||
//I think that setting the velocity to 0 was preventing surface contacts from entering an infinite loop
|
//I think that setting the velocity to 0 was preventing surface contacts from entering an infinite loop
|
||||||
state.touching.insert(collision);
|
state.touching.insert(collision);
|
||||||
|
//insta booster!
|
||||||
|
if let Some(booster)=&general.booster{
|
||||||
|
state.cull_velocity(data,booster.boost(state.body.velocity));
|
||||||
|
}
|
||||||
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
||||||
let zone=mode.get_zone(convex_mesh_id.model_id.into());
|
let zone=mode.get_zone(convex_mesh_id.model_id.into());
|
||||||
match zone{
|
match zone{
|
||||||
@ -1526,7 +1515,11 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
|
|||||||
if let Some(walk_state)=state.move_state.get_walk_state(){
|
if let Some(walk_state)=state.move_state.get_walk_state(){
|
||||||
if let Some(jump_settings)=&state.style.jump{
|
if let Some(jump_settings)=&state.style.jump{
|
||||||
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
|
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
|
||||||
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity);
|
let booster_option=match data.models.attr(walk_state.contact.convex_mesh_id.model_id){
|
||||||
|
PhysicsCollisionAttributes::Contact{contacting:_,general}=>general.booster.as_ref(),
|
||||||
|
PhysicsCollisionAttributes::Intersect{..}=>None,
|
||||||
|
};
|
||||||
|
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity,booster_option);
|
||||||
state.cull_velocity(&data,jumped_velocity);
|
state.cull_velocity(&data,jumped_velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user