func_rotating Problem
Quote from jwien001 on September 15, 2009, 12:24 amSo as a part of my level, I have a platform that has multiple objects spawn on top of it (using env_entity_makers) arranged as below (top-down view):
------------------
|--X--X--X--X--|
|--X---------X--|
|--X---------X--|
|--X--X--X--X--|
------------------- and | = platform
X = env_entity_maker location (i.e. spawn point)When this platform is a world brush, the objects spawn in place without moving, as you would expect them too. However, I need this platform to rotate, so my next step I decided was to tie this brush to a func_rotating entity so that it would spin. When I did this though, some of the objects (but not all) would spawn and instantaneously start moving away from the center of the platform as if some force was pushing them away. When I change the platform back to a world brush, the problem goes away. Any ideas what is causing this and how I could fix it?
EDIT: FYI, I did realize that I could've just posted screenshots instead of typing up an ASCII drawing, but since it's there I'll leave it as is (unless screenshots are needed for clarification).
So as a part of my level, I have a platform that has multiple objects spawn on top of it (using env_entity_makers) arranged as below (top-down view):
------------------
|--X--X--X--X--|
|--X---------X--|
|--X---------X--|
|--X--X--X--X--|
------------------
- and | = platform
X = env_entity_maker location (i.e. spawn point)
When this platform is a world brush, the objects spawn in place without moving, as you would expect them too. However, I need this platform to rotate, so my next step I decided was to tie this brush to a func_rotating entity so that it would spin. When I did this though, some of the objects (but not all) would spawn and instantaneously start moving away from the center of the platform as if some force was pushing them away. When I change the platform back to a world brush, the problem goes away. Any ideas what is causing this and how I could fix it?
EDIT: FYI, I did realize that I could've just posted screenshots instead of typing up an ASCII drawing, but since it's there I'll leave it as is (unless screenshots are needed for clarification).
Quote from HMW on September 15, 2009, 11:59 amWhat type of objects are you spawning? If it's static things like func_buttons, set their parent to the moving object. (But note that some entities, like func_movelinear, behave strangely when attached to other objects.)
I'm not sure if a parent setting on the template is carried over correctly on spawned instances so you'll have to test that. If it doesn't, then set the parent at run time via the OnEntitySpawned output of the entity maker.
If you are spawning physically simulated objects like cubes or turrets, you have to make sure that the velocity of the spawned objects is equal to that of the platform, otherwise they will fall off. I have never tried this myself so I don't know if it is even possible to keep physics objects onto a spinning platform, but try setting the PostSpawnSpeed and PostSpawnDirection on each entity maker.
(Oh, and don't forget to attach the entity makers themselves to the platform )
What type of objects are you spawning? If it's static things like func_buttons, set their parent to the moving object. (But note that some entities, like func_movelinear, behave strangely when attached to other objects.)
I'm not sure if a parent setting on the template is carried over correctly on spawned instances so you'll have to test that. If it doesn't, then set the parent at run time via the OnEntitySpawned output of the entity maker.
If you are spawning physically simulated objects like cubes or turrets, you have to make sure that the velocity of the spawned objects is equal to that of the platform, otherwise they will fall off. I have never tried this myself so I don't know if it is even possible to keep physics objects onto a spinning platform, but try setting the PostSpawnSpeed and PostSpawnDirection on each entity maker.
(Oh, and don't forget to attach the entity makers themselves to the platform )
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic
Quote from jwien001 on September 16, 2009, 3:31 pmLet me clarify. I am spawning turrets. However, the turrets spawn when the platform is static. Then at a later time the platform begins to rotate, dumping the turrets into a pit below. The platform then stops, and a new set of turrets respawns.
Let me clarify. I am spawning turrets. However, the turrets spawn when the platform is static. Then at a later time the platform begins to rotate, dumping the turrets into a pit below. The platform then stops, and a new set of turrets respawns.
Quote from jwien001 on September 16, 2009, 8:22 pmOkay, so I partially fixed the problem. I moved the point_template and attached env_entity_makers up off the ground 128 units. Now, only one turret spawns with any sort of initial velocity (env_entity_maker PostSpawn Movement Speed still set to 0), and even more peculiarly, only the second time it spawns. When I spawn all the turrets OnMapSpawn, all of them stay in place as they should. Then, after those turrets are dumped into the pit, a new set spawns, and only one turret flies off the platform.
EDIT: I just tried placing a trigger at the bottom of my pit that killed any objects that fell down into it. Now, the one turret doesn't fall off, but the four on the opposite end of the platform do, again only on the second spawn. Does anyone have any idea what is causing this bizarre error?
Okay, so I partially fixed the problem. I moved the point_template and attached env_entity_makers up off the ground 128 units. Now, only one turret spawns with any sort of initial velocity (env_entity_maker PostSpawn Movement Speed still set to 0), and even more peculiarly, only the second time it spawns. When I spawn all the turrets OnMapSpawn, all of them stay in place as they should. Then, after those turrets are dumped into the pit, a new set spawns, and only one turret flies off the platform.
EDIT: I just tried placing a trigger at the bottom of my pit that killed any objects that fell down into it. Now, the one turret doesn't fall off, but the four on the opposite end of the platform do, again only on the second spawn. Does anyone have any idea what is causing this bizarre error?
Quote from HMW on September 19, 2009, 6:28 pmThe only explanation for this random behaviour I can think of, is that the turrets are spawning a little bit inside the platform, and are pushed out by the physics engine. If they are close to an edge, the physics engine might choose to push them in the direction of either the top or the side of the platform.
Try moving your entity makers up one unit and test the map. If some turrets still fall off, move the entity makers up one unit again, re-test etc. (Only move the entity makers, not the template.) Another solution might be to move the turrets closer to the centre, or make the platform bigger.
The fact that different turrets fall off every time probably has nothing to do with the changes you described, but with the randomness of the func_rotating entity, which stops at different angles every time you turn it on and off.
The only explanation for this random behaviour I can think of, is that the turrets are spawning a little bit inside the platform, and are pushed out by the physics engine. If they are close to an edge, the physics engine might choose to push them in the direction of either the top or the side of the platform.
Try moving your entity makers up one unit and test the map. If some turrets still fall off, move the entity makers up one unit again, re-test etc. (Only move the entity makers, not the template.) Another solution might be to move the turrets closer to the centre, or make the platform bigger.
The fact that different turrets fall off every time probably has nothing to do with the changes you described, but with the randomness of the func_rotating entity, which stops at different angles every time you turn it on and off.
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic