test billboard

This commit is contained in:
2025-03-12 09:07:18 +01:00
parent 20e68ab39e
commit 17a2ed676b
6 changed files with 67 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ use std::{f32::consts::PI, time::Duration};
use crate::{
DebugVisuals,
alien::{ALIEN_ASSET_PATH, Animations},
billboards::Billboard,
camera::GameCameraRig,
cash::{Cash, CashCollectEvent},
heads_ui::HeadChanged,
@@ -15,6 +16,7 @@ use bevy::{
window::{CursorGrabMode, PrimaryWindow},
};
use bevy_dolly::prelude::Rig;
use bevy_sprite3d::{Sprite3dBuilder, Sprite3dParams};
use bevy_tnua::{TnuaUserControlsSystemSet, prelude::*};
use bevy_tnua_avian3d::TnuaAvian3dSensorShape;
@@ -68,6 +70,7 @@ fn spawn(
asset_server: Res<AssetServer>,
query: Query<&Transform, With<SpawnPoint>>,
mut player_spawned: ResMut<PlayerSpawned>,
mut sprite_params: Sprite3dParams,
) {
if player_spawned.spawned {
return;
@@ -81,6 +84,7 @@ fn spawn(
let mesh = asset_server
.load(GltfAssetLabel::Scene(0).from_asset("models/heads/angry demonstrator.glb"));
let selector = asset_server.load("ui/selector.png");
commands
.spawn((
@@ -109,6 +113,18 @@ fn spawn(
.with_rotation(Quat::from_rotation_y(std::f32::consts::PI))
.with_scale(Vec3::splat(1.5)),
SceneRoot(asset_server.load(GltfAssetLabel::Scene(0).from_asset(ALIEN_ASSET_PATH))),
))
.with_child((
Billboard,
Transform::from_translation(Vec3::new(0., 1.5, 0.)),
Sprite3dBuilder {
image: selector,
pixels_per_metre: 40.,
alpha_mode: AlphaMode::Blend,
unlit: true,
..default()
}
.bundle(&mut sprite_params),
));
commands.spawn((