Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bone look_at function? #144856
08/01/07 01:48
08/01/07 01:48
Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Hi George,
I made the turret work from AUM21 Thanks, Thank you

I am trying to create a bone version of the turret, the goal is a single entity, please see this c-script thread. There is a problem when the entity's tilt angle is not zero.
bone problem

Do you plan to have a workshop about bone in one of the next AUM?

Re: bone look_at function? [Re: Frederick_Lim] #144857
08/01/07 18:55
08/01/07 18:55
Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
I have written two workshops about bones, so I'm afraid that I won't write a new one too soon. You can get the c-script workshops I've written at Conitec's download page (close to the bottom of the page).

Re: bone look_at function? [Re: George] #144858
08/13/07 07:05
08/13/07 07:05
Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Yes I read your bone tutorials when I make my test, and I learn a lot from AUM to create my game.

But my problem is when the model tilt up or down, the bone doesn't look where I point to anymore. If you run my test level in C-script thread you will see, I want a bone_look_at function But these code fail when the model tilt up/down.

Code:
vec_for_bone(my.span, me, "bone2");
vec_diff(temp, player.x, my.span);
vec_to_angle(my.span, temp);



Re: bone look_at function? [Re: Frederick_Lim] #144859
08/13/07 20:12
08/13/07 20:12
Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
The code looks ok to me. What is the exact angle range where you see the problems?

Re: bone look_at function? [Re: George] #144860
08/14/07 03:26
08/14/07 03:26
Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
I post the complete code here
Code:
ENTITY* tur;

PANEL modelang {
digits(5, 130, "tilt: %f", *, 1, tur.tilt);
flags = VISIBLE;
}

view etur1_view = {
layer = 1;
pos_x = 470;
pos_y = 360;
size_x = 130;
size_y = 100;
arc = 20;
aspect = 1;
ambient = 10;
fog = 10;
//genius = null;
flags = VISIBLE;
}

function main()
{
video_switch(6,0,2);
level_load("bonetest.wmb");
wait(3); // wait until the level is loaded
//mouse_mode = 2; // now show the pointer

camera.x = -200;
camera.z = 100;
camera.tilt = -25;
}

action turret()
{
tur = me;
while (player == NULL) { wait(1); }
var temp2;

while (1)
{
my.tilt += mouse_force.y;

vec_for_bone(temp2, me, "bone2");
vec_diff(temp, player.x, temp2.x);
vec_to_angle(temp2, temp);

ent_bonereset(me, "bone1");
ent_bonereset(me, "bone2");

//pan
ent_bonerotate(me,"bone1", vector(temp2.pan, 0, 0));

//tilt
ent_bonerotate(me,"bone2",vector(0, temp2.tilt, 0));

// attach a camera to the front of barrel
vec_for_vertex(temp, me, 170);
vec_set(etur1_view.x, temp);
ang_for_bone(etur1_view.pan, me, "bone2");

wait(1);
}
}

action satellite
{

player = me;
while (tur == NULL) { wait(1); }
var rotAng = 0;

while(1)
{
rotAng = (rotAng - time_step) % 360;
my.x = tur.x - 200 * sin(rotAng);
my.y = tur.y + 200 * cos(rotAng);
my.z = sin(total_ticks * 5 + 1000) * 80;
wait(1);
}
}



The model has 2 bones, a satellite move orbit around the entity. I want to Entity constantly look at the satellite, if the entity tilt is 0, everything fine.



But if the entity tilt is non-zero, it cannot look at the satellite correctly. I think because if the entity tilt has change, the bone1 will move bone2, causing the code vec_to_angle not work as expected.



You may download my test project here [35K]: bone.zip

Re: bone look_at function? [Re: Frederick_Lim] #144861
08/14/07 15:21
08/14/07 15:21
Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,008
Bucharest, Romania
I have tested the demo; if bone1 changes bone2's position indeed, you've got your explanation. Did you try to create the turret using separate model pieces?

Re: bone look_at function? [Re: George] #144862
08/14/07 16:02
08/14/07 16:02
Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 825
22�21'24"N 114�07'30"E
Yes I am using separate model pieces now, just want to know the possible solution for bone. Because I am lazy to separate the model and create different set of skin


Moderated by  George 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1