Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Ayumi, 1 invisible), 1,291 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
incorrect camera-movement #250560
02/08/09 19:07
02/08/09 19:07
Joined: Nov 2007
Posts: 13
Germany / Munich
V
V_Sola Offline OP
Newbie
V_Sola  Offline OP
Newbie
V

Joined: Nov 2007
Posts: 13
Germany / Munich
hi guys,

it's me again. I want my camera to be constantly behind my model but i don't manage to fix up an correct c_move-function.

Can anyone help me?

that's my code:

////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>


////////////////////////////////////////////////////////////////////

ENTITY* wizard;

////////////////////////////////////////////////////////////////////


}
function main()
{
//video_mode = 7; // 800x600 pixels
video_switch (8,32,1);
level_load ("Drohne_Level_1.wmb");


}

action wizard_with_pointer()
{
wizard = my;
my.ambient = 100;
while(1)
{
VECTOR speed;

my.pan += -50 * mouse_force.x * time_step;

speed.x += 5 * (key_a - key_d) * time_step;
speed.y += 5 * (key_s - key_w) * time_step;

c_move (my,speed,nullvector,IGNORE_PASSABLE | GLIDE);

camera.x = my.x;
camera.y = my.y - 150;
camera.z = my.z + 25;

camera.pan = my.pan + 270;
camera.tilt = - 12;

my.red = 100;
wait(1);
}
}

action wizard_simple()
{
my.ambient = 100;
}

Re: incorrect camera-movement [Re: V_Sola] #250566
02/08/09 19:18
02/08/09 19:18
Joined: Oct 2008
Posts: 67
C
Crypton Offline
Junior Member
Crypton  Offline
Junior Member
C

Joined: Oct 2008
Posts: 67
Maybe this will clear out something:
(play with the values and change player for my)
vec_set(camera.x,player.x);
camera.z += 63;
camera.x -= 100*cos(player.pan);
camera.y -= 100*sin(player.pan);
camera.pan = player.pan;

Cheers!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: incorrect camera-movement [Re: Crypton] #250576
02/08/09 19:57
02/08/09 19:57
Joined: Nov 2007
Posts: 13
Germany / Munich
V
V_Sola Offline OP
Newbie
V_Sola  Offline OP
Newbie
V

Joined: Nov 2007
Posts: 13
Germany / Munich
now it looks like this:

action wizard_with_pointer()
{
wizard = my;
my = player;
player.ambient = 100;
while(1)
{
//VECTOR speed;

player.pan += -50 * mouse_force.x * time_step;

player.x += -5 * (key_a - key_d) * time_step;
player.y += -5 * (key_s - key_w) * time_step;

c_move (my,nullvector,nullvector,IGNORE_PASSABLE | GLIDE);

vec_set(camera.x,player.x);

camera.x -= 100*cos(player.pan);
camera.y -= 100*sin(player.pan) - 150;
camera.z += player.z + 25;

camera.pan = player.pan;
camera.tilt = - 12;


wait(1);
}
}

but the camera still moves wrong and the engine doesn't find the pointed model.
Wheres my mistake?

Last edited by V_Sola; 02/08/09 19:59.
Re: incorrect camera-movement [Re: V_Sola] #250577
02/08/09 20:03
02/08/09 20:03
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
my = player;

would be

player = me;


3333333333
Re: incorrect camera-movement [Re: Quad] #250580
02/08/09 20:21
02/08/09 20:21
Joined: Oct 2008
Posts: 67
C
Crypton Offline
Junior Member
Crypton  Offline
Junior Member
C

Joined: Oct 2008
Posts: 67
also it would have been easier (as I mentioned before) to just change player to my. player is built-in pointer. As you have already wizard pointer created, you don't have to attach this action to player pointer anymore.
If you choose to use player then replace wizard with player. But I guess you use wizard pointer somewhere else, so this wouldn't be a good idea!

Cheers!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: incorrect camera-movement [Re: Crypton] #251252
02/12/09 09:05
02/12/09 09:05
Joined: Nov 2007
Posts: 58
austria
nsksleeper Offline
Junior Member
nsksleeper  Offline
Junior Member

Joined: Nov 2007
Posts: 58
austria
@V-Sola: hi, i think i had the same problem. do you see the model(the wizard) from the side? if so, go to med and rotate the model in the upper left window that it faces to the right. Maybe that helps


visit www.nsk-austria.org and vote for sleeper by clansman of the year.

and also look at www.break.com/index/lightningstrikescar.html
Re: incorrect camera-movement [Re: nsksleeper] #251254
02/12/09 09:17
02/12/09 09:17
Joined: Aug 2008
Posts: 43
Germany, Baden-Württemberg
M
Mageron Offline
Newbie
Mageron  Offline
Newbie
M

Joined: Aug 2008
Posts: 43
Germany, Baden-Württemberg
I created an own view called Sicht and some new variables:
VAR sicht_dist[3] = -20,0,20; //The dist form the view to the player
VAR sicht_ang[3];

Add this in your Action:

vec_diff(temp,nullvector,sicht_dist);
vec_to_angle(sicht_ang,temp);
vec_set(Sicht.x,sicht_dist);
vec_rotate(Sicht.x,my.pan);
vec_add(Sicht.x,my.x);
vec_set(Sicht.pan,sicht_ang);
ang_add(Sicht.pan,my.pan);

I hope I could help you.


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