Page 1 of 1

Machine and Scenery Problems

Posted: Sun Aug 19, 2007 8:02 am
by Seattlefanman
I have been adding some machines and scenery to my map and it has been fine but now any scenery or machines I place are randomly spawning. Anyone know what I could have done wrong?

Re: Machine and Scenery Problems

Posted: Sun Aug 19, 2007 8:28 am
by killarzachary
Seattlefanman wrote:I have been adding some machines and scenery to my map and it has been fine but now any scenery or machines I place are randomly spawning. Anyone know what I could have done wrong?
Did you use the shift a ctrl buttons when placing them? Ussually when you do that it becomes unalligned in game.

Posted: Sun Aug 19, 2007 8:40 am
by Seattlefanman
Yeah thats what I did so im guessing that is my problem?

Posted: Sun Aug 19, 2007 9:22 am
by killarzachary
Seattlefanman wrote:Yeah thats what I did so im guessing that is my problem?
Yup.

Posted: Sun Aug 19, 2007 9:28 am
by *JP*
So instead of using the ctrl and alt buttons, how else would you place things besides finding the coordinates for each individual thing you want to place? Because we all know the easiest way is to use the entity controls to do so. What would be the correct way to do this with out any inconvienences?

Posted: Sun Aug 19, 2007 10:17 am
by killarzachary
*JP* wrote:So instead of using the ctrl and alt buttons, how else would you place things besides finding the coordinates for each individual thing you want to place? Because we all know the easiest way is to use the entity controls to do so. What would be the correct way to do this with out any inconvienences?
I'm not sure, but if you use the meta editor it would work better, I know if your modifying a tree, 30 = on its side 60 = unpside down.

Posted: Sun Aug 19, 2007 12:00 pm
by CaptainPoopface
You can still use the BSP Viewer. Just make sure that you never apply more than one type of rotation to an object. That is what messes up Entity, because it uses Euler angles, from what I've read. So if you need to do a lot of yawing, make that the only type of rotation you do with the BSP Viewer. That means, once you push Alt and click, do NOT touch shift or control. I think even if you set your angles in the meta editor, adjusting more than one type of angle (yaw, pitch, roll) will make the BSP Viewer depict the orientation of that object unreliably (but it WILL be correct in-game - you have to leave it looking wrong in the Viewer). I've tried adjusting yaw, saving changes, shutting down the Viewer, then reopening it to adjust pitch or roll, and it still doesn't work.

So, if you need to apply two or all three types of rotation, you will have to do some calculating in your head. The angles for YPR are in radians. Radians express the distance around a circle in proportion to its radius (hence the name). There are 2 * pi radians in the circumference of a circle. So 360 degrees = 2 * pi radians, and if you want to convert from degrees to radians, multiply your degrees by pi/180. Anything greater than 2 * pi, or less than -2 * pi, simply goes around the circle again. So your |angle| never needs to exceed 2 *pi.

I've seen some really hacky values in YPR in various people's mods... KZ, the reason 30 is "on its side" is that 30 mod 2*pi is roughly pi/2, which is 90 degrees. Here are some conversions of common angles that you might use:

45 degrees = pi/4 = 0.7854 radians
90 degrees = pi/2 = 1.5708
180 degrees = pi = 3.1416
315 degrees = -45 degrees = -0.7854

Note that positive angles define rotation in a counterclockwise direction, and negative angles rotate the object clockwise. So if you start rotating an object and say, "That's the right axis of rotation, but it's spinning the wrong way," just invert the sign of your angle. In other words, 3 left turns = 1 right turn (270 degrees = -90 degrees). Sometimes negative angles are a little easier to think about than positive angles, especially if you have the workhorse angles of the positive first half of the circle memorized.

When setting two or three different types of rotation, you'll have to rely on your ability to visualize these angles, and do some checking by FTPing the map to your Xbox and playing it. Yaw, pitch and roll are defined relative to the XYZ axes (plural of axis) of the object model, NOT the XYZ axes of the map. Every object defines its axes in its own way. It's usually intuitive, but if you're not sure what each type of rotation will do, put four different copies of the object directly over one another, separated by 10 or 20 units on the Z axis, preferably way up in the air where you won't collide with anything else. Use the bottom object as your default, and apply only yaw to the next object, only pitch to the one up from that, and only roll to the last one. Note that you will be applying these angles in the meta editor, not the BSP Viewer. Then load up your map on the Xbox and verify which directions YPR rotates the object. Look at the Z coordinates of each object to determine which one is which. Always remember the default orientation of the object, because it's usually easier to make your mental calculations based on that, instead of making iterative adjustments relative to whatever funky orientation the object might currently be in.

By now, I'm fairly comfortable handling YPR entirely in my head, and you'll get there with enough practice. One last hint is to know which way the X and Y axes are oriented on your map. Positive Z is always straight up. Fly around the level in the BSP Viewer, and push the left, right, zoom in and zoom out buttons while watching how the X and Y coordinates in the lower right corner change. When X is changing very fast but Y is changing slowly or not at all, you're moving along the X axis. Find a geographical feature of the map that gives you a landmark for positive X or positive Y. For example, in Zanzibar, if my memory is correct, running from the center of the windmill to the shed with active camo is positive Y, and running from the windmill to the shed with the turbines is positive X. I use the BSP Viewer to place the objects, then set the angles in the meta editor. If some corrective translation is needed after the YPR, I do that by guess and check.

I hope this helps. I should post it in the tutorial section.


Note to Anthony/pokecancer: I think it would be easy to fix the BSP Viewer's rotation problem, but I may be talking out of my butt. You just keep track of the object's starting YPR, let the user rotate it any which way, and then have a button that says "Finalize rotation." When the user clicks that, Entity will calculate the difference between the final and initial YPR of the object, THEN apply the actual rotation. Right now, it looks like Entity rotates the object iteratively after every release of the mouse and keys, and that leads to botches with the Euler computation. If you only apply one set of YPR rotations, calculated from the object's initial and final orientations, the counterintuitive Euler sequence should be avoided. Right?

Posted: Mon Aug 20, 2007 5:34 am
by *JP*
I think you should, (post this in the tut section that is). From what I've read, what you wrote will help alot of people out there. Thanks CaptainPoopface for breaking it all down. This will help tremendously