physics: rework jumping and boosters
This commit is contained in:
parent
7996df532e
commit
05ec7ea5d8
25
Cargo.lock
generated
25
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",
|
||||||
@ -1900,9 +1900,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_bsp_loader"
|
name = "strafesnet_bsp_loader"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "6d4af68c422b5f57febbaa218f44ba02d413fd25e84afff9e45e557a8caee2ce"
|
checksum = "b6b3e1324034abfd648e339580989f8f2c30ac2009296229349d88b8fcb4eedd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"strafesnet_common",
|
"strafesnet_common",
|
||||||
@ -1912,10 +1912,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_common"
|
name = "strafesnet_common"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "e6155b62ce5d118d1aab0d90d6d6981bca1e046c4ca86829bc93215e8b3bb929"
|
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"glam",
|
"glam",
|
||||||
"id",
|
"id",
|
||||||
@ -1923,9 +1924,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_deferred_loader"
|
name = "strafesnet_deferred_loader"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "c3891dcbdbc20b03cf561786b810e839ae7c11dd8810fd005f2474805ee9cccc"
|
checksum = "9d5ad437524fb201fd5be68f76c53dd831e81ccad4655e19e3d1ca201863b566"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy-regex",
|
"lazy-regex",
|
||||||
"strafesnet_common",
|
"strafesnet_common",
|
||||||
@ -1934,9 +1935,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_rbx_loader"
|
name = "strafesnet_rbx_loader"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "21ea93b0170063dd2a063a138c41e6f7a6c14a82c6553fa4ba32df65a26efc6e"
|
checksum = "3a910867e1f5ab2d9cc9c178973aee7fa029547e27465e47fea2eb99b860bb81"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"glam",
|
"glam",
|
||||||
@ -1951,9 +1952,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[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",
|
||||||
|
@ -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