sizeOf – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search

Forgive my ignorance. I am confused. Example 1 - sizeOf "M1Abrams" A good example includes a meaningful return value within a certain context. How would the size of a M1Abrams change throughout the battle? Can someone clarify for me? --ViperMaul 17:44, 2 June 2007 (CEST)

The size, of course, doesn't change, but the object you're measuring has to be present in the current mission, otherwise only zero is returned. --Kronzky 00:06, 3 June 2007 (CEST)

Ok I think I get what you are saying. I will still be looking forward to some applied examples on the content page. In how to best use this. Thanks. --ViperMaul 01:25, 3 June 2007 (CEST)

An example usage is to get the length from center of vehicle to the end of it, so you could make it look like you are towing it. To do this, use the sizeOf object then divide it by two. Then add a little buffer space so the 'towing' vehicle doesn't collide with the towed object. You can then do 'attachto [0,val,0] and it will attach behind the towtruck. If you did not have this command, it would be very frustrating to make a towtruck script look good with different object sizes. (SU25 verses UAZ for example)

I am confused too ... what does this command boundingbox not do ? (ok, get the maximum of cause, but for which use ?) The maximum can be also reached in the height too, or i'm wrong ? --Lester 03:11, 3 June 2007 (CEST)

My guess is that "boundingbox" requires that the scripter do some extra calculations to get the value 'sizeof type will give you.
Essentially, to place two vehicles beside each other, it may now be about as simple as newpos = oldpos; newpos set [0,newpos select 0 + sizeof _type]
Cleaning that one up to make it more understandable and a little less generic might be a good idea before putting it in the article. Verifying it, and providing a better context, is absolutely required. --MaHuJa 17:00, 11 June 2007 (CEST)