Spawning Game Object

Announcements, support questions, and discussion for Quest Machine.
Post Reply
Mach4
Posts: 28
Joined: Thu Jul 22, 2021 4:16 pm

Spawning Game Object

Post by Mach4 »

Hello Tony -

In my "Collection" quest, I am spawning 3 objects using spawn points. For testing I am using three cubes with the mesh turned off. I get an object to spawn, but it does not always spawn in the same location within the "Spawn location" game object (Cube). Is there a way to fine tune that ?


Thanks
RIck
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawning Game Object

Post by Tony Li »

Hi Rick,

If your Spawner's Position Info > Position Type is set to Spawnpoints, then it will choose one of the spawnpoints you've assigned to the Spawnpoints list. Then it will move the spawned object to the exact same position and rotation as the spawnpoint.

If the object has a NavMeshAgent (e.g., an NPC that can move around), it will move the object using NavMeshAgent.Warp(), which keeps the object on a navmesh. If the object isn't exactly on the spawnpoint, maybe NavMeshAgent.Warp() is adjusting the position to keep it on a navmesh.

Otherwise, if it doesn't have a NavMeshAgent, it will assign the transform position directly (i.e., transform.position = spawnpoint.transform.position). If the object isn't exactly on the spawnpoint, maybe the physics simulation is causing it to fall to the ground or otherwise teeter off position.
Mach4
Posts: 28
Joined: Thu Jul 22, 2021 4:16 pm

Re: Spawning Game Object

Post by Mach4 »

There is no a navmesh issue, so it must be a physics issue. Had not thought about that and I will check that out.


Thanks
Rick
Post Reply