Add joystick-controlled character with camera follow and bat/pistol combat
Replaces the placeholder cube with ZombiePunk_Character: rigged model with Idle/SlowWalk/Loot animations, tap-to-move joystick control, AABB collision against crate colliders, and a pistol/bat weapon swap driven by facing a destructible object (Loot anim doubles as the melee hit since there's no dedicated swing clip). Camera (CameraFollowC) follows with framerate-independent damping, a smoothed look-ahead that pans toward the character's facing direction, and obstacle-avoidance raycasting from eye height so short props don't falsely block the view. Spawn point and forward convention flipped to the other end of the road per request. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
CameraC_internal,
|
||||
CameraType,
|
||||
// JoystickC,
|
||||
JoystickC,
|
||||
Physics_internal,
|
||||
Template,
|
||||
Template3d,
|
||||
@@ -26,21 +26,15 @@ export const beforeResourcesLoadedCb = () => {
|
||||
|
||||
Physics_internal.init(new Vec3(0, -9.81, 0));
|
||||
|
||||
// example of using joystick. Uncomment if you need joystick
|
||||
|
||||
// JoystickC.init({
|
||||
// zone: document.getElementById("joystick_zone") as HTMLDivElement,
|
||||
// fadeTime: 0,
|
||||
// mode: "dynamic",
|
||||
// restJoystick: true,
|
||||
// catchDistance: 1,
|
||||
// restOpacity: 0,
|
||||
// follow: false,
|
||||
// });
|
||||
|
||||
// JoystickC.onJoysticMove.addDelegate(({event, data}) => {
|
||||
// console.log('onJoysticMove', event, data);
|
||||
// })
|
||||
// zone is omitted on purpose: JoystickC auto-creates a full-screen zone
|
||||
// when none is given, so the joystick can appear wherever the player taps
|
||||
JoystickC.init({
|
||||
mode: "dynamic",
|
||||
fadeTime: 100,
|
||||
restJoystick: true,
|
||||
restOpacity: 0,
|
||||
follow: false,
|
||||
});
|
||||
|
||||
Template.updateVariableConfig.addDelegate(([category, variable, value]) => {
|
||||
if (category === "global") {
|
||||
|
||||
Reference in New Issue
Block a user