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:
@@ -41,19 +41,19 @@ export const globalSettings: ConfigUiParamsCategories[] = [
|
||||
visible: "position",
|
||||
values: [
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
0
|
||||
-20,
|
||||
30,
|
||||
-2
|
||||
],
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
1
|
||||
],
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
-5,
|
||||
40,
|
||||
5
|
||||
],
|
||||
[
|
||||
-20,
|
||||
70,
|
||||
42
|
||||
]
|
||||
]
|
||||
},
|
||||
@@ -67,7 +67,7 @@ export const globalSettings: ConfigUiParamsCategories[] = [
|
||||
[
|
||||
-360,
|
||||
360,
|
||||
0
|
||||
-25
|
||||
],
|
||||
[
|
||||
-360,
|
||||
@@ -99,19 +99,19 @@ export const globalSettings: ConfigUiParamsCategories[] = [
|
||||
visible: "position",
|
||||
values: [
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
0
|
||||
-20,
|
||||
30,
|
||||
-2
|
||||
],
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
1
|
||||
-5,
|
||||
40,
|
||||
6
|
||||
],
|
||||
[
|
||||
-10,
|
||||
10,
|
||||
5
|
||||
-20,
|
||||
70,
|
||||
37
|
||||
]
|
||||
]
|
||||
},
|
||||
@@ -125,7 +125,7 @@ export const globalSettings: ConfigUiParamsCategories[] = [
|
||||
[
|
||||
-360,
|
||||
360,
|
||||
0
|
||||
-60
|
||||
],
|
||||
[
|
||||
-360,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { BoxGeometry, Mesh, MeshStandardMaterial, Vector3 } from "three";
|
||||
import { ThreeC } from "./ThreeC";
|
||||
import { InputC, JoystickC } from "@hitplay/playable_template";
|
||||
|
||||
export class TestSceneC {
|
||||
static init() {
|
||||
this.createPrimitive();
|
||||
this.createMap();
|
||||
|
||||
// example of using InputC events
|
||||
InputC.onTouchDown.addDelegate((event) => {
|
||||
@@ -17,26 +16,18 @@ export class TestSceneC {
|
||||
// });
|
||||
}
|
||||
|
||||
private static createPrimitive() {
|
||||
const geometry = new BoxGeometry(1, 1, 1);
|
||||
const material = new MeshStandardMaterial({ color: 0xcc0000 });
|
||||
const cube = new Mesh(geometry, material);
|
||||
private static createMap() {
|
||||
const map = ThreeC.getObject("map");
|
||||
|
||||
const geometryPlane = new BoxGeometry(5, 0.1, 7);
|
||||
const materialPlane = new MeshStandardMaterial({ color: 0xaaaaaa });
|
||||
const plane = new Mesh(geometryPlane, materialPlane);
|
||||
// physics-only collision proxies exported alongside the visual meshes; hide them
|
||||
map.traverse((child) => {
|
||||
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.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);
|
||||
ThreeC.addToScene(map);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,14 +1,14 @@
|
||||
// import { ConvertToBase64WhenRelease } from "@hitplay/ads_common";
|
||||
import { ConvertToBase64WhenRelease } from "@hitplay/ads_common";
|
||||
import { ConvertResourceType, Template3d } from "@hitplay/playable_template";
|
||||
|
||||
|
||||
export const meshes : ConvertResourceType = {
|
||||
type: "mesh",
|
||||
resources: [
|
||||
// {
|
||||
// name: "scene",
|
||||
// value: ConvertToBase64WhenRelease("./SceneСombo.glb"),
|
||||
// },
|
||||
{
|
||||
name: "map",
|
||||
value: ConvertToBase64WhenRelease("./ZombiePunk_Map.glb"),
|
||||
},
|
||||
],
|
||||
loader: Template3d.meshLoader
|
||||
}
|
||||
Reference in New Issue
Block a user