aGorm Mod Images - Page 4

## aGorm Mod Images

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

### Re: aGorm Mod Images

Or Is is because I'm doing somthing wrong?
yes
Do I need to have some kind of fail safe for that eventuality
yes
and how would you suggest doing it?

Code: Select all

``````...
bodyTilt = math.asin(bodyLRHeight/25)
...
BRA = math.asin((BR_height-bodyLRHeight)/47)
FRA = math.asin((FR_height-bodyLRHeight)/47)
BLA = math.asin((BL_height+bodyLRHeight)/47)
FLA = math.asin((FL_height+bodyLRHeight)/47)
...
``````
Remember what the definition of sine is in a right triangle, or better in the unit circle.

Now because sine is a ratio between two numbers, its inverse is only valid where that ratio exists (has a defined value). This happens to be between -1 and 1. If you pass in a value outside that range, you get back a special value which represents a non-number, aka NaN. So, clamp any argument v to math.asin such that -1 <= v <= 1.

edit: goddamn ninjas
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

OK, so that makes a lot of sense (obviosly if the cliff height is large than the track length one divided by the other will be more than 1, should have noticed that)

So question is... is there a usefull way to set the number to 1 or -1 that doesn't require 2 if statments for each wheel (as I assume thats probably not the best way to do it.)

at the moment all I can think to do is assign "BR_height-bodyLRHeight" to a varible, then do an if >1 then be 1 or if < -1 be -1, but it feels like there must be a better way...
0 x

zwzsg
Kernel Panic Co-Developer
Posts: 7024
Joined: 16 Nov 2004, 13:08

### Re: aGorm Mod Images

maybe something like:

local clamp = function(x) return math.max(-1,math.min(1,x)) end
BRA = math.asin(clamp((BR_height-bodyLRHeight)/47))
FRA = math.asin(clamp((FR_height-bodyLRHeight)/47))
BLA = math.asin(clamp((BL_height+bodyLRHeight)/47))
FLA = math.asin(clamp((FL_height+bodyLRHeight)/47))
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

OK, thanks with the help, I've got it checking now and I get no more errors.

Now however I'm stuck with a slightly different but related problem.

The move def means it can go down the side of these cliffs, which is exactly what I want. However... because the unit is 5 x 5 it can easily overhang cliffs/ embed itself into cliffs, as it seems to let the centre of the unit go to the edge of the cliff. Is there anything I can do to make it not do this? Or is it a limitation I'll have to live with (unless I find time to learn c as well... which Is unlikely)

aGorm
Attachments
issue.jpg
0 x

AF
AI Developer
Posts: 20678
Joined: 14 Sep 2004, 11:32

### Re: aGorm Mod Images

You could make limit how far each track is able to deviate from the other tracks and the center?
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

No, thats not the problem... it needs to be able to do that to get up slopes in its slope tollerance... I dont mind the fact the legs do that when they overhang, what I don't want is it to unit overhang. (Cars dont drive with half the bodywork hanging over the side of a cliff, or have the ability to become incorpral to move the back half through a wall)
0 x

AF
AI Developer
Posts: 20678
Joined: 14 Sep 2004, 11:32

### Re: aGorm Mod Images

I mean in that case 3 of the legs match, and the final deviates quite badly, so you can put minimum and maximums relative to the other legs depending on wether the slope underneath would cause clipping or not. This would prevent instances where 3 legs are flat and one leg is inside a pot hole.
0 x

AF
AI Developer
Posts: 20678
Joined: 14 Sep 2004, 11:32

### Re: aGorm Mod Images

Alternatively, think of it as a piece of paper and your 4 legs are the corners, if you hold 3 on a plane, how far is the 4th corner allowed to bend? At the moment it's infinity.
0 x

FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6187
Joined: 29 Apr 2005, 01:14

### Re: aGorm Mod Images

No solution I am aware of at present aGorm.
0 x

knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

### Re: aGorm Mod Images

Everything that leaves the unit's footprint can potentially clip into terrain or other units. That's how it works...
No idea if there are plans to allow for non-square footprints for mobiles.
0 x

zwzsg
Kernel Panic Co-Developer
Posts: 7024
Joined: 16 Nov 2004, 13:08

### Re: aGorm Mod Images

Give its suspensions a wide course, and pump them high when the body is at risk of grating an edge.
0 x

Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

### Re: aGorm Mod Images

Hard to say without having seen how you've coded it. Is the problem that it's tilted that far over or that it picked such a path where it's hanging off the cliff?
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

Hard to say without having seen how you've coded it. Is the problem that it's tilted that far over or that it picked such a path where it's hanging off the cliff?
The latter, IE the path it picked hangs of the cliff. The script is doing exactly what I want it to do. It's the engin and were it thinks the unit can travers thats borked. Imagin it was just a normal tank (say a Challenger 2) and say I was nuts enough to make it 10 by 10 in spring terms.... currently a 10 x 5 bit of footprint would be over the edge of the cliff.

It would make more sense if the pathing only let the footprint move to the edge, not the center.

However I assume that would mean an engine change.

aGorm
0 x

FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6187
Joined: 29 Apr 2005, 01:14

### Re: aGorm Mod Images

aGorm wrote:
Hard to say without having seen how you've coded it. Is the problem that it's tilted that far over or that it picked such a path where it's hanging off the cliff?
The latter, IE the path it picked hangs of the cliff. The script is doing exactly what I want it to do. It's the engin and were it thinks the unit can travers thats borked. Imagin it was just a normal tank (say a Challenger 2) and say I was nuts enough to make it 10 by 10 in spring terms.... currently a 10 x 5 bit of footprint would be over the edge of the cliff.

It would make more sense if the pathing only let the footprint move to the edge, not the center.

However I assume that would mean an engine change.

aGorm
You have indeed correctly identified the issue, and I'm pretty sure it would not be a trivial thing to change.

edit: iirc <--- disclaimer
0 x

Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

### Re: aGorm Mod Images

Probably a massive effort to change. That being said, could, when a tile has a path cost>k1, the pathfinder increase the cost to nearby tiles with path cost<k2? Where k1 is steep and k2 is flat.
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

OK, so for now I'm gonna ignor the visual stupidity of the unit doing that as its not like I can do much about it for now.

So moving on... I have worked out how to make it deploy and do the animation for that, but what I dont know is how to tell it it can't move while deployed, and how to stop it shooting when its not deployed. (Also, if you know how to make it deploy automaticly if its not but has been told to shoot... that would be usefull as well.)

I'm assuming it's somthing to do with setting the maxspeed to 0, but I can't find the bit of the wiki that tells you how...

aGorm
0 x

knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

### Re: aGorm Mod Images

Why not make new threads for new questions?
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

becasue then I'll be spamming up teh forum with each new one, instead of just 1 thread ...

aGorm

::EDIT:: Also that site is awesome, I shall look there first from now on and post questions there.
0 x

Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

### Re: aGorm Mod Images

hey agorm, I just spotted this and was curious

Was the little building next to the big wind generator where you got the idea for the IW power generators?
0 x

aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

### Re: aGorm Mod Images

Relly not sure, its possible I had seen that at some point and it inspired me later down the line... didn't have a visual referance when I originaly made them though other than my own doodles.
0 x