Import map model and frame camera at the road start

Registers ZombiePunk_Map.glb as a mesh resource, loads it into the scene
(hiding physics-only collider proxies), and sets initial camera position/
rotation for portrait and landscape to look at the start of the road.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Oleksandr Vlasiuk
2026-08-07 15:32:40 +03:00
parent 5b953edf17
commit ce86f54777
4 changed files with 37 additions and 46 deletions
+21 -21
View File
@@ -41,19 +41,19 @@ export const globalSettings: ConfigUiParamsCategories[] = [
visible: "position", visible: "position",
values: [ values: [
[ [
-10, -20,
10, 30,
0 -2
], ],
[ [
-10, -5,
10, 40,
1
],
[
-10,
10,
5 5
],
[
-20,
70,
42
] ]
] ]
}, },
@@ -67,7 +67,7 @@ export const globalSettings: ConfigUiParamsCategories[] = [
[ [
-360, -360,
360, 360,
0 -25
], ],
[ [
-360, -360,
@@ -99,19 +99,19 @@ export const globalSettings: ConfigUiParamsCategories[] = [
visible: "position", visible: "position",
values: [ values: [
[ [
-10, -20,
10, 30,
0 -2
], ],
[ [
-10, -5,
10, 40,
1 6
], ],
[ [
-10, -20,
10, 70,
5 37
] ]
] ]
}, },
@@ -125,7 +125,7 @@ export const globalSettings: ConfigUiParamsCategories[] = [
[ [
-360, -360,
360, 360,
0 -60
], ],
[ [
-360, -360,
+11 -20
View File
@@ -1,10 +1,9 @@
import { BoxGeometry, Mesh, MeshStandardMaterial, Vector3 } from "three";
import { ThreeC } from "./ThreeC"; import { ThreeC } from "./ThreeC";
import { InputC, JoystickC } from "@hitplay/playable_template"; import { InputC, JoystickC } from "@hitplay/playable_template";
export class TestSceneC { export class TestSceneC {
static init() { static init() {
this.createPrimitive(); this.createMap();
// example of using InputC events // example of using InputC events
InputC.onTouchDown.addDelegate((event) => { InputC.onTouchDown.addDelegate((event) => {
@@ -17,26 +16,18 @@ export class TestSceneC {
// }); // });
} }
private static createPrimitive() { private static createMap() {
const geometry = new BoxGeometry(1, 1, 1); const map = ThreeC.getObject("map");
const material = new MeshStandardMaterial({ color: 0xcc0000 });
const cube = new Mesh(geometry, material);
const geometryPlane = new BoxGeometry(5, 0.1, 7); // physics-only collision proxies exported alongside the visual meshes; hide them
const materialPlane = new MeshStandardMaterial({ color: 0xaaaaaa }); map.traverse((child) => {
const plane = new Mesh(geometryPlane, materialPlane); if (/collider/i.test(child.name)) {
child.visible = false;
}
});
let planePosition = plane.position.clone(); ThreeC.setShadowsStateForChildren(map, true, true);
ThreeC.setShadowsStateForChildren(cube, true, false); ThreeC.addToScene(map);
ThreeC.setShadowsStateForChildren(plane, false, true);
plane.position.copy(
new Vector3(planePosition.x, planePosition.y - 0.5, planePosition.z - 1.5)
);
ThreeC.addToScene(cube);
ThreeC.addToScene(plane);
} }
} }
Binary file not shown.
+5 -5
View File
@@ -1,14 +1,14 @@
// import { ConvertToBase64WhenRelease } from "@hitplay/ads_common"; import { ConvertToBase64WhenRelease } from "@hitplay/ads_common";
import { ConvertResourceType, Template3d } from "@hitplay/playable_template"; import { ConvertResourceType, Template3d } from "@hitplay/playable_template";
export const meshes : ConvertResourceType = { export const meshes : ConvertResourceType = {
type: "mesh", type: "mesh",
resources: [ resources: [
// { {
// name: "scene", name: "map",
// value: ConvertToBase64WhenRelease("./SceneСombo.glb"), value: ConvertToBase64WhenRelease("./ZombiePunk_Map.glb"),
// }, },
], ],
loader: Template3d.meshLoader loader: Template3d.meshLoader
} }