Jump to content
Sign in to follow this  
BLSmith2112

Simulate X/Y/Z position of vehicle?

Recommended Posts

Say I want to make a simulated effect where certain vehicles can appear to be stacked ontop of eachother. Kinda like the end of a resident evil movie where that chick is holding a shotgun and there's dozens of vehicles around piled ontop of eachother.

Or perhaps another example of not only a vehicle but a building buryed in the ground:

picxts3.jpg

What would this look like in a script?

Share this post


Link to post
Share on other sites

... I don't know what ANY of the terminology means as the Wiki demonstrates. And with my luck, the Operation Flashpoint 'setPos' thing isn't 100% the same as with ArmA.

Does it go in a trigger?

Does it go in a init field?

Does it go in a script?

setPos has 3 examples. I don't know the difference between any of them

I don't know how to find XYZ of an object.

Even the "descriptiion" for "setVector": Set object's direction vector. Up vector will remain unchanged.... even that is confusing.

setVector up, same as all previous...

That's much more than I'll ever understand... seems like too much work for 3 seconds of a film I'm making. Not to mention, even if for some reason I understood this stuff.. The Vehicles don't "stick" they fall to the ground.

Unless anyone wants to describe all of that.. in English... in ArmA and not OFP terminology... I'll be sure to listen. Otherwise, if you could just show me a quick example, I can learn from there and change any of the numbers inside the script to experiment.

Share this post


Link to post
Share on other sites

... I don't know what ANY of the terminology means as the Wiki demonstrates. And with my luck, the Operation Flashpoint 'setPos' thing isn't 100% the same as with ArmA.

Quote[/b] ]Does it go in a trigger?

Does it go in a init field?

Does it go in a script?

Since it's a few commands then it doesnt matter where you put it. If the mission will be MP make sure all computers see the command.

Quote[/b] ]setPos has 3 examples. I don't know the difference between any of them

setPos needs 2 things. The object your moving and where to. The place where your moving it to is an array of 3 dimensional cordinates, X,Y and Z. Using an exact number in an array is a bit difficult, so you would normally setPos it to an object or gamelogic. To do this you can do:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos (getpos object1)

Put that in the init field of the object you want to move, and change object1 to what ever you named the object that you want to move to.

Quote[/b] ]I don't know how to find XYZ of an object.

The getPos command does this. For example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unitpos = _getpos unit1

This will then make _unitpos an array, like [X,Y,Z]

Quote[/b] ]

Even the "descriptiion" for "setVector": Set object's direction vector. Up vector will remain unchanged.... even that is confusing.

setVector up, same as all previous...

I'm sorry, but I can't expain these either, I find it just as confusing lol.

Share this post


Link to post
Share on other sites

I really do appreciate the help..Perhaps I understood 1-2 sentences..However, my head is now spinning faster than ever before... It's only a matter of time before it explodes.. I'm so lost. Why's this got to be so hard for me? huh.gif

Share this post


Link to post
Share on other sites

From what I understand, you need a script to pile vehicles on top of each other, is that correct?

The problem in ArmA will be that the physics engine isn't robust enough to effectively pile vehicles. It will work with large, heavy square shaped objects but once it comes to complex objects such as vehicles, they will just start bouncing around until they come to a stop on something solid - usually the ground.

What you need is a script that allows you to fix the height and direction (including tilt) of a vehicle. I could make you a script if you like, but it would have two minor limitations:

1: The object's position would be totally FIXED. That means you would not be able to make it move unless you somehow abort the script. If you want piles of cars that can be tipped over, then that will be very nearly impossible.

2: The script would have to use a loop to continually set the object's position and direction so that it does not fall or bounce around. Loops like this will slow down the game if you use them on too many objects, so you can't make a huge field with hundreds of cars piled around.

<s>Let me know if you want me to make it.</s>

EDIT:

I've made a quick beta version. Download it here.

Images:

mzmichfegd.jpg

gpmsngkcss.jpg

To use the script you must place it into your mission directory and write the following in the init line of each vehicle that you want to set the position of:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">x = [this,Fix,Height,Direction,Roll,Bow] execVM "setObjectPosition.sqf"

Explanation:

this - Refers to the object. Must not be changed

Fix - True or False. Set to true if you want to force the object into the position and keep it there. Otherwise set to false (vehicle will drop).

Height - The object's height above the ground in meters.

Direction - Must be set because the ingame direction setting will no longer work.

Roll - Set the roll direction (sideways tilt) in degrees. 90 will place the vehicle on it's side, 180 will place it on it's back etc.

Bow - Bow direction. Does not yet fully work, because I'm not really an expert at vectors, but it can be used to some extent. The bow direction makes the object tilt forward.

Here are a few examples:

Make the object lie on it's back:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">x = [this,false,1,0,180,0] execVM "setObjectPosition.sqf"

Make the object float, tilted on it's side and slightly forward, 1 meter above the ground:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">x = [this,true,1,0,90,20] execVM "setObjectPosition.sqf"

There are still a few bugs, as it is still in beta. Try it out.

Share this post


Link to post
Share on other sites

Wow Mad. You really are a nice guy biggrin_o.gif

I'll be sure to dissect as much of this as I can tomorrow. I didn't expect this at all heh, so thanks again Mad for your help. And to JasonO for his explaination as well. Thanks guys, I'll open it up tomarrow morning. Oh and: Yes, it is totally fixed, that's what I was hoping for wink_o.gif

edit: I couldn't wait. I had to try this out MadDog! Very nice indeed. The only thing I noticed is vehicles burst into flame within seconds. In any event, I really appreciate the work you put in for me. I'd do it myself but lack the knowledge sad_o.gif

Edit2: I just added a 'this setdammage 0.0' inside one of the loops and it seemed to work wink_o.gif This is totally excellent! I'll be sure you credit you MadDog in the credits of my next film (in the coming months, still have to have all the essential tools down)... My past movie's have sucked so I plan on purchasing a 'gamepad' for camera movement, and would like to research scripts like these for ultimately a better movie. Hopefully come up with some of my own if I can learn somehow lol.

'

Thanks Mad again.

edit 3: It seems to work without bursting into flames when the vehicle is.. say 180' upside-down but if it was 182' upside-down it burst into flame again.

Share this post


Link to post
Share on other sites

Yeah the bursting into flames seems to be a problem with the engine. Looks like it happens if you force vehicles into awkward positions. Strange.

I also noticed, if you make a car hover in the air in a strange position, the wheels will start turning very fast.

I can't do anything about the wheels turning, but I'll try and fix the damage thing.

Share this post


Link to post
Share on other sites

If its an Engine thing, no worries. I'm going to be experimenting today with some things.

Share this post


Link to post
Share on other sites

I've experimeneted a bit with this, and it seems that only movable object (say, cars) don't want to stay where you put them. Unmovable objects (houses, wrecks etc.) stay put. So you could try to make the scene you want with non-movable objects.

Actually, this thread gave me a nice idea for making a strong point from wrecks instead of the usual fortress/sandbags. Rotating the wrecked car created this nice little position from which to shoot. The left car was moved so that it lies on the wreck of the jeep.

carmovedsr4.th.jpg

This is the original position of the car. You can see the position in the back.

carorglr7.th.jpg

edit - removed space

Share this post


Link to post
Share on other sites
I've experimeneted a bit with this, and it seems that only movable object (say, cars) don't want to stay where you put them.

That's a necessity since, as you said, they are movable, so they must have active physics so they can react properly to the environment and other objects. You can't leave cars floating in the air or underground because gravity and collisions effect them, where static objects aren't, because these static objects don't need to move and since it is often necessary that these objects remain perfectly still and aren't effected by surroundings.

Share this post


Link to post
Share on other sites

It still would be nice to be able to freeze vehicles.

Perhaps a static vehicle with the properties of a building will come in the add-on days... Doubt it, but hey! With 10,000+ addons surely coming after the tools are released, anything is possible.

Share this post


Link to post
Share on other sites

Hope you don't mind MadDog. I found this script so useful I thought others would as well. So I added it to the FAQ smile_o.gif

Share this post


Link to post
Share on other sites
Hope you don't mind MadDog. I found this script so useful I thought others would as well. So I added it to the FAQ smile_o.gif

No problem. I've been playing around with the script and I've found loads of strange bugs that cannot be remedied. All happen when the position of the vehicle is fixed.

- If a car is tilted, the wheels will keep turning.

- Vehicles hanging in the air may cause damage to infantry.

- Vehicles will slowly be destroyed if tilted.

- If only vehicle height is set, the vehicle will start spinning in mid air when rammed.

I would suggest NOT using the fix function except when needed in cutscenes.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×