• Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at \$59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

# Ilici

Member Since 23 Mar 2003
Offline Last Active Jan 05 2014 12:04 PM

### Rotation under varying force

16 June 2009 - 02:27 AM

This is quite a tough one. I'm working on a flight simulation and aircraft are modeled as a rigid solid moving under drag. I'm making the AI system so I need to plan a path for the airplane - thus i need to spin it around so it points in the right direction. Rotation is determined the usual way, by integrating torque twice. Torque is equal to the force applied using the flight stick to which a linear drag is applied. Thus
```T = max_rotational_velocity_konst * StickInput[-1..1] - w * C
```
C is the drag constant and is calculated from the 'max_rotational_velocity_konst' constant and the 'time_to_reach_max_vel' constant - so that the designers can model a plane that achieves a certain angular velocity in a certain time (if the stick is kept at maximum during that time). Next, the angular velocity is equal to the integral of Torque.
```w = (T / (inv_mass * inertia)) * dt;
```
And finally, the angle of rotation is equal to
```alpha = w * dt
```
Unfortunately, several stick movements need to be input each frame (so that behaviors can be tweened - ground avoidance for one should increase in priority as the plane gets closer to the ground) and I can't change this. Thus my AI will input stick commands to make the plane roll to the right direction by measuring the angle between its current rotation and the desired rotation. I take the CrossProduct of the two 'Up' vectors so I get the sinus of the angle. I use this value as the StickInput value - thus it will achieve 0 input when its in the right angle. Thus:
```T = max_rot_speed * sin(alpha) - w * C
w = integral(T)
alpha = integral(w)
```
What I want is to find the angla as a function of time in order to determine the time it will take for the aircraft to achieve a certain rotation. I've already found a way to do it for constant force from here, but I don't know how to use it for a varying force. Any ideas?

### Impostor texture allocation

26 April 2009 - 04:56 AM

I'm working on a cloud system using impostors and it is currently working quite well, only that I'm using a single impostor texture resolution. I want to be able to render far-away impostors to lower resolution textures than the near ones. I've tried sorting impostors away from the camera and allocating textures from a list where resolution decreases by index (8 big textures, 20 mid-size, 50 small), but I run into the problem of impostors that need to be re-rendered into a different but same resolution texture. Is there any algorithm that fits this problem well? I'm thinking about keeping some lists of allocated textures and keeping track of unallocated ones to allow swaps because of distance to camera changes in the clouds.

### Friend classes weirdness

03 March 2009 - 10:51 PM

This has been bugging me lately... Let's say I have 3 classes: EDIT: changed private to protected in base, TestFriend* with tpl* in BaseTpl, added more members, replaced A with TestFriend
```template <tpl>
class BaseTpl<tpl>
{
BaseTpl(tpl* owner) { pOwner = owner; }
protected:
tpl* pOwner;
}

class InheritTpl : public BaseTpl<TestFriend>
{
void doStuff()
{
pOwner->f();     //COMPILE ERROR - cannot access private member
pOwner->m_i = 0; //COMPILE ERROR - cannot access private member
}
}

class ManyStates<tpl>
{
ManyStates(tpl parent) { m_states[0] = new InheritTpl(parent); }
BaseTpl<tpl>* m_states[];
}

class TestFriend
{
template<class> friend class BaseTpl;
ManyStates m_StateMachine;

TestFriend() : m_StateMachine(this) { }

protected: //tried private: too

void f();
int m_i;
}
```
So, is there any restriction on friend classes when using inheritance? Or is it some kind of compiler weirdness? I'm using CodeWarrior, which may increase the likelihood of the latter. [Edited by - Ilici on March 4, 2009 8:39:14 AM]

05 January 2009 - 10:17 AM

I'm looking into buying a bluetooth headset, something like this. I have a bag in which I carry my cellphone and when driving, if I get a call it's quite annoying to try to get it out with one hand or wait for a stoplight. Moreover, I hate holding the phone while I'm at the wheel. So what I want is to keep my headset in the car, possibly charge it from the car's 12V plug, and when I get a call I can just put it on, press a button and talk. Is this possible? Would the headset automatically link up with the phone when i turn it on and the phone is near (and probably ringing)? I'd rather not spend 20 bucks on one if this wouldn't work.

### Critique my hardware configuration + what games to play on it?

31 July 2008 - 04:24 AM

It's been a long long time since I bought a brand new PC - about 8 years actually. I did get a laptop in this time but it's of no great use to gaming. Since I've got a new job as a game programmer I figured I need a new machine to play the current games to keep up with times.

MOBO: ASROCK P45TurboTwins2000
CPU: INTEL Core 2 Duo E8400
VID: SAPPHIRE ATI Radeon HD4850 512MB DDR3 256bit
Hdd1: WESTERN DIGITAL 150GB, 10000rpm, SATA, 16MB - bitchin fast [smile]
Hdd2: WESTERN DIGITAL 500GB, 7200rpm, SATA 2, 16MB
RAM: CORSAIR 4GB 800Mhz RAM

It all adds up to about \$1100 at the cheapest online store (converted to \$ from local prices, may differ from US prices).

So, what do you think, could I change something for the better while staying in the budget?

[b]update: read here - what games to play on it?

[Edited by - Ilici on July 31, 2008 3:59:03 PM]

PARTNERS