Home   Help Search Login Register  

Author Topic: frequently asked camcreate Q  (Read 2063 times)

0 Members and 1 Guest are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
frequently asked camcreate Q
« on: 02 Apr 2003, 16:22:57 »
Hi! I know this Q has been asked several times but I didnÂ't find anything while using the search function. Sry. :-[ :-*

How do I camcreate something 1 meter behind a guy, two meters in front of a guy, three meters right to a guy and 1 meter infront of a guy etc. Y axis are unimportant. Please help.

Thx in advance.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:frequently asked camcreate Q
« Reply #1 on: 02 Apr 2003, 16:47:20 »
when you camcreate something you have to specify the position.   And, as you know, there are lots of ways of specifying a position.

camcreate [getPos loon1 select 0, (getPos loon1 select 1) + 1, 0]

will create the thing 1m from the loon at ground level.     Hey, setRelPos might even work, who knows.   syntax not guaranteed of course.

To get it in front you might need to use getDir and some trigonometry.
Plenty of reviewed ArmA missions for you to play

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:frequently asked camcreate Q
« Reply #2 on: 02 Apr 2003, 17:07:46 »
OK. I have tried a couple of tests but I canÂ't get it to work. I only get it over me or not at all.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:frequently asked camcreate Q
« Reply #3 on: 02 Apr 2003, 17:17:09 »
If you can get it on top of you we are half wa there.    The next bit is just getting the syntax right ..... do what I suggested but make it 10 rather than 1, 1m is a bit close.   What happens then?
Plenty of reviewed ArmA missions for you to play

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:frequently asked camcreate Q
« Reply #4 on: 02 Apr 2003, 17:20:09 »
If you can get it on top of you we are half wa there.    The next bit is just getting the syntax right ..... do what I suggested but make it 10 rather than 1, 1m is a bit close.   What happens then?

Same thing.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:frequently asked camcreate Q
« Reply #5 on: 02 Apr 2003, 17:22:16 »
lol that's a bit annoying.    Copy and paste the command you're using here so I can see it.
Plenty of reviewed ArmA missions for you to play

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:frequently asked camcreate Q
« Reply #6 on: 02 Apr 2003, 17:25:13 »
setrelpos is the answer to your question.


_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal","back"]

_cam camsettarget moped
_cam camsetrelpos [-2,10,3]
_cam camcommit 0


Will create the camera 2 meters left 10 meters in front and 3 meters above the moped. Really nice command. I use it a lot.
Not all is lost.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:frequently asked camcreate Q
« Reply #7 on: 02 Apr 2003, 17:25:35 »
I just saw that it was the same as the one you set height! I told ya I have tested a bit, and know IÂ'm back at the start ;).

Back to work. Added the zero on the end as in your version. The error text came up.

Error 4 elements provided, 3 expected

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:frequently asked camcreate Q
« Reply #8 on: 02 Apr 2003, 17:29:31 »
setrelpos is the answer to your question.


_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal","back"]

_cam camsettarget moped
_cam camsetrelpos [-2,10,3]
_cam camcommit 0


Will create the camera 2 meters left 10 meters in front and 3 meters above the moped. Really nice command. I use it a lot.

Hmmm. How do you camcreate a building for instance with the setrelpos?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:frequently asked camcreate Q
« Reply #9 on: 02 Apr 2003, 17:31:08 »
If its a camera you want, go with Artak.  

Or is it an object, like you want a table to appear out of thin air?
Plenty of reviewed ArmA missions for you to play

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:frequently asked camcreate Q
« Reply #10 on: 02 Apr 2003, 17:43:50 »
an object. Like a bomb.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:frequently asked camcreate Q
« Reply #11 on: 02 Apr 2003, 17:52:36 »
Oh yeah right.. you want to
Quote
camcreate something
not a camera. Didn't read that too well did I   :D

I've never done it but basicly what you'd need to do is combine getdir with your camcreate command.
So
something = "something" camcreate [(getpos someone select 0)+2,getpos someone select 1, getpos someone select 2]
won't work because the guy could be facing any direction and the above would always set the item 2 meters east of him.

I'm puzzled.
Not all is lost.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:frequently asked camcreate Q
« Reply #12 on: 02 Apr 2003, 18:06:11 »
It can certainly be done, its just a question of converting polar coordinates [5m in front of the loon] to cartesian coordinates [x,z].     20 years ago I could have done it in my head.  Now I can't.    We need a 15 year old to do the trig.     OFP has trig functions, so that's no bother.

What bothers me more is that Armsty hasn't got the wretched thing to appear just 5m away in any direction yet.    That's the first problem.
Plenty of reviewed ArmA missions for you to play

titan

  • Guest
Re:frequently asked camcreate Q
« Reply #13 on: 02 Apr 2003, 21:54:01 »
i dont know much about cords. but if you want to create smething so it gets created from an object then try this...

explode = "heat120" camcreate getpos unitname


the wep cld be changed to other types of explosives,  i dont know anything about objects like buildings or tables. trying to find that myself!

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:frequently asked camcreate Q
« Reply #14 on: 03 Apr 2003, 01:49:56 »
You're after a big of trig...

I surprised you didn't find anything on this with a search, as I seem to remember answering this question a few times now... but anyway.. ;)

Here's a generic example line:

object = "objecttype" createvehicle [(getpos unit select 0) + sin (getdir unit + bearing) * distance, (getpos unit select 1) + cos (getdir unit + bearing) * distance, 0]

Looks like fun, huh ;D
It's actually much simpler than it looks. I'll use the first part (the X co-ord) as an example:

(getpos unit select 0) + sin (getdir unit + bearing) * distance

Breaking it down into parts:
  • (getpos unit select 0)
    Gets the X co-ord of the unit you want to place your object around
  • sin (getdir unit + bearing) * distance
    Here's the business end of it... Using a bit of trig, it gets the sin of the direction the unit is facing, adds any bearing you want, and moves the object out to the distance you specify. So:
    unit - The unit you are placing the object relative to
    bearing - The offset in relative bearing from the unit where you want the object placed.
    Eg. 0 = directly in front of the unit
    180 = directly behind the unit
    90 = to the unit's right.
    Try to imagine a circle of degrees around the unit, with 0 at the top and 180 at the bottom... ;)
    distance  - the distance from the unit you want the object to be placed.
The bit with the Y co-ord is exactly the same, except that sin is replaced with cosin, and the (getpos unit select 0) is (getpos unit select 1), as we're now working with the Y axis ;)

So a couple of practical examples:

1m behind the guy:
object 1 = "objecttype" createvehicle [(getpos unit select 0) + sin (getdir unit + 180) * 1, (getpos unit select 1) + cos (getdir unit + 180) * 1, 0]

3m to the right of the guy:

object 2 = "objecttype" createvehicle [(getpos unit select 0) + sin (getdir unit + 90) * 3, (getpos unit select 1) + cos (getdir unit + 90) * 3, 0]

Just a quick note: use createvehicle rather than camcreate. Since it can now create munitions, createvehicle has superseeded camcreate...

By the way... I'm a bit older than 15, Macca ;D ;D
« Last Edit: 03 Apr 2003, 01:51:27 by Sui »