mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
fix: use max of dispersion
This commit is contained in:
1 parent
d19d4e0e26
commit
5ab0a12f4c
1 file changed
+5
-9
+5
-9
@@ -34,7 +34,6 @@ const [modelDefinitions, equipmentDefinitions, provisionDefinitions] =
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const emptyVector = new Vector2();
|
const emptyVector = new Vector2();
|
||||||
const FAR_DISTANCE = 1000;
|
|
||||||
|
|
||||||
export function SceneProps() {
|
export function SceneProps() {
|
||||||
const show = TankopediaPersistent.use(
|
const show = TankopediaPersistent.use(
|
||||||
@@ -105,7 +104,7 @@ export function SceneProps() {
|
|||||||
);
|
);
|
||||||
let { dispersion } = characteristics;
|
let { dispersion } = characteristics;
|
||||||
const gunRotationSpeed = degToRad(characteristics.gunTraverseSpeed);
|
const gunRotationSpeed = degToRad(characteristics.gunTraverseSpeed);
|
||||||
const mockTank = useLoader(GLTFLoader, asset(`3d/tanks/models/12305.glb`));
|
const mockTank = useLoader(GLTFLoader, asset(`3d/tanks/models/6929.glb`));
|
||||||
const texture = useLoader(TextureLoader, imgur('C28Z8nU'));
|
const texture = useLoader(TextureLoader, imgur('C28Z8nU'));
|
||||||
const path = new Vector3();
|
const path = new Vector3();
|
||||||
const direction = new Vector3();
|
const direction = new Vector3();
|
||||||
@@ -141,7 +140,7 @@ export function SceneProps() {
|
|||||||
let length: number;
|
let length: number;
|
||||||
|
|
||||||
if (cameraIntersections.length === 0) {
|
if (cameraIntersections.length === 0) {
|
||||||
length = FAR_DISTANCE;
|
length = characteristics.shellRange;
|
||||||
direction.set(0, 0, -1).applyQuaternion(camera.quaternion);
|
direction.set(0, 0, -1).applyQuaternion(camera.quaternion);
|
||||||
aimTarget.copy(shellOrigin).addScaledVector(direction, length);
|
aimTarget.copy(shellOrigin).addScaledVector(direction, length);
|
||||||
} else {
|
} else {
|
||||||
@@ -190,7 +189,7 @@ export function SceneProps() {
|
|||||||
|
|
||||||
dispersion += dispersionModDischarged;
|
dispersion += dispersionModDischarged;
|
||||||
} else {
|
} else {
|
||||||
dispersion = characteristics.dispersion * penalty;
|
dispersion = Math.max(characteristics.dispersion * penalty, dispersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
modelTransformEvent.emit({ pitch, yaw });
|
modelTransformEvent.emit({ pitch, yaw });
|
||||||
@@ -213,7 +212,7 @@ export function SceneProps() {
|
|||||||
if (gunIntersections.length === 0) {
|
if (gunIntersections.length === 0) {
|
||||||
gunTarget = shellOrigin
|
gunTarget = shellOrigin
|
||||||
.clone()
|
.clone()
|
||||||
.add(gunDirection.multiplyScalar(FAR_DISTANCE));
|
.add(gunDirection.multiplyScalar(characteristics.shellRange));
|
||||||
} else {
|
} else {
|
||||||
gunTarget = gunIntersections[0].point;
|
gunTarget = gunIntersections[0].point;
|
||||||
}
|
}
|
||||||
@@ -272,10 +271,7 @@ export function SceneProps() {
|
|||||||
<meshStandardMaterial color={0xff8040} />
|
<meshStandardMaterial color={0xff8040} />
|
||||||
</mesh>
|
</mesh>
|
||||||
|
|
||||||
<group
|
<group position={[0, 0, -25]} rotation={[-Math.PI / 2, 0, Math.PI]}>
|
||||||
position={[0, 0, -182]}
|
|
||||||
rotation={[-Math.PI / 2, 0, Math.PI]}
|
|
||||||
>
|
|
||||||
<primitive object={mockTank.scene} />
|
<primitive object={mockTank.scene} />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in new issue
Block a user