пятница, 8 февраля 2013 г.

скачать e2 lkz gmod

Here is the code that elevates the left gun mount.

This part works very similarly to the rotation code, except now we’re changing the props Pitch instead of Yaw.

The second line is actually what moves the plate. We use ApplyAngForce on the plate, and give it the angle we just made. We also add the current angle to what the target angle was the last cycle. This is very important, as it increases the stability of the gun. What it’s doing is actually using a PID loop to give us a alternating series that converges on the target bearing, but you don’t need to know that. Just know that it makes the movements more precise and controlled.

The first line does several things. First, it calculates the bearing (how far left or right) from the target. It then converts that bearing (which is just a number) into an angle (Pitch, Yaw, Roll). Pitch and Roll are zero because we only want to change the Yaw of the rotating plate. We then multiply this whole angle by 500 to give it some force when it actually moves. Lastly we negate the angle so that the turret moves towards the bearing, not away from it.

SpinPlate:applyAngForce(LateralTargetAng + $LateralTargetAng * Error)

LateralTargetAng = -ang(0, SpinPlate:bearing(AimPos), 0) * 500

Next we want to rotate the turret so it is facing the target. We do that with these two lines:

This is pretty easy. Just use owner():AimPos(). This is wherever the owner of the turret is currently aiming.

Probably the most difficult part is using the ApplyAngForce correctly. Here’s a brief walk through on how it works for this turret.

This little guy runs off of one Expression 2 chip, which does some vector to angle conversions, and then uses ApplyAngForce() to aim the turret.

The circular plate is axis-constrained onto the 3x3x1 block, which is in turn welded onto the robotics base. A 2x2x4 block is welded to the circular plate, providing a good mount for the 2x2x2 blocks, which provide the elevation mounts for the guns themselves. These are axis-constrained onto the middle block. Three entity markers identify the three moving parts, which allows the code to actually move the parts. I went ahead and colored everything a dark gray, with the left gun being green and the right one being red; this helps identify the front of the turret.

1x – Wire Expression 2 Chip

1x – Wire Laser Pointer Receiver

2x – PHX3 2×2 Block

1x – PHX3 Circular Plate

The construction for this one was fairly straightforward and simple, which makes the programming and operation all that much easier. I recommend using the Easy Precision tool to make precise welds and axis constraints.

Download: Version: 1.0 Filesize: 319.15 KB Date Added: 05-05-2010 Downloads: 439 Category: GMod Tags: adv dup, advanced duplicator, turret, targeted, laser, e2, expression 2, garrys mod, gmod Description: A laser targeted, Expression 2 controlled turret for Garry's Mod. Download includes a detailed picture of the components, the E2 Code, and an Advanced Duplicator file of the turret.

This thing is a laser-targeted machine gun turret. It will follow your laser pointer around shooting as it goes.

Tools: Garry’s Mod, Wiremod, Expression 2

Laser Targeted Turret | Chrono101.com

Комментариев нет:

Отправить комментарий