Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, Quad, soulman3, Ayumi, steyr, 3run), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
true facing of sprites? #185946
02/27/08 07:52
02/27/08 07:52
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
this has probably been asked before...

we set:
my.oriented=off;
my.facing=on;
for sprites in our space simulator. but since it's a space simulator, you can look at the sprites from any direction you want to.
I'm not sure what angle it's at (I think when you look straight down or up and then see the sprite sitting there?), but the sprite turns in a weird way at some point. when you pan around and the sprite's in your view, at a certain point, it'll roll about 90 to 180 degrees at once. we don't want that. help?

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: true facing of sprites? [Re: Germanunkol] #185947
02/27/08 08:12
02/27/08 08:12
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
The sprite doesn't roll but the camera.

Re: true facing of sprites? [Re: vlau] #185948
02/28/08 17:45
02/28/08 17:45
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
hm.
all right...
but there must be some sort of workaround?
I need to rotate the camera, making the camera not roll is no option.
and since there's quite a few of these sprites, I'd like it to be a rather efficient way...
I must admit, up to today, I can't get my head around angles in 3d space. I understand them, yes, but how to work with them when it comes to the whole euler angle calculations... bah!

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: true facing of sprites? [Re: Germanunkol] #185949
02/28/08 18:54
02/28/08 18:54
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
I think there is a way to accomplish this. It's very late
at night here, I'll write you the code tomorrow.

BTW, how do you like the camera rotate around the sprite?
Select the sprite by clicking on it then use the movement
keys to pan and tilt around it?

Re: true facing of sprites? [Re: vlau] #185950
02/28/08 20:07
02/28/08 20:07
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
no... the camera follows a space ship that cam move freely through space...
the space ship can pan, tilt and roll at any point around it's own arbitrary axis.

sorry I wasn't clear on this...
and thanks for helping!

Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: true facing of sprites? [Re: Germanunkol] #185951
02/28/08 20:12
02/28/08 20:12
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
A common work a round is to use 3 sprites, 2 in a cross vertical formation and the last centered in a horizontal position so that no matter what angle you view from the sprite shows as it should.

Maybe you already tried this other wise, you need to script it to face the way you want in relation to the camera.

Re: true facing of sprites? [Re: Nems] #185952
02/29/08 04:32
02/29/08 04:32
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
...easier way. Ok, When a sprite uses it's ".facing" flag, it doesn't exactly point to the camera. Instead, it stays parallel to the viewing plane...

...this means if the sprites by the edge of your view, it will appear to be pointing behind you a bit.

So to get around this, just hardcode you sprites to point towards the camera:

Code:

action star()
{
while (my)
{
vec_diff(temp, camera.x, my.x);
vec_to_angle(my.pan, temp);
//
wait(1);
}
}




xXxGuitar511
- Programmer
Re: true facing of sprites? [Re: Germanunkol] #185953
02/29/08 10:33
02/29/08 10:33
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
I'm guess the problem is your follow camera code. Here is my solutions,
the idea is came from the Manual->chase camera example code :

I'll create a dummy object as the target at runtime, it'll always stay
the same position as the spaceship while you can pan and tilt of its own.
The camera will follow the dummy's pan and tilt and maintain the distance
from the spaceship, with that, you're free to look around the space with
the spaceship as the aim point and those sprites (or camera) will not flip
when the camera tilt angle reached 90 and 270 degrees.

Hope that it was what are you looking for.

Code:

var dist[3] = -2500,0,300; // play with it
var speed = 5; // pan, tilt speed
entity* dummy;

action theSprite
{
// Your sprites should have these lines
my.passable = on;
my.facing = on;
my.oriented = off;
//...other codes...
}

action tSpaceShip
{
dummy = ent_create(NULL,my.x,NULL);
dummy.passable = on;

while(my)
{
//c_move(....); // move spaceship

vec_set(dummy.x,my.x); // same pos as the spaceship

// pan and tilt the camera to look around with wsad keys
dummy.pan -= (key_a-key_d) * speed * time_step;
dummy.tilt -= (key_w-key_s) * speed * time_step;

// camera follow codes
vec_set(camera.x,dist);
vec_rotate(camera.x,dummy.pan);
vec_add(camera.x,dummy.x);
vec_set(camera.pan,dummy.pan);

// ...other codes...

wait(1);
}
}



Re: true facing of sprites? [Re: vlau] #185954
03/04/08 12:50
03/04/08 12:50
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
thanks for the replies!

to be honest, I don't believe it's the camera script.

I do:

Code:

camera_height = camera_distance/2;
vec_set(temp,vector(-camera_distance,0,camera_height));
vec_rotate(temp,cam_dummy_ent.pan);
vec_add(temp,player.x); //target position of camera;
vec_set(camera.x,temp);


or something along those lines (the camera lags behind as well, but that shouldn't change anything.

your code only involves paning and tilting... how about rolling? may that be it?
My space ship can roll as well...

I understood your concept. i tried the same thing as well, when trying to make the player look around space without rotating the ship. reason I didn't put it in yet is that I wanted the cam to keep the angle/position relative to the ship's rotation if you let go off the key that lets you manually set the cam.
ie: key shift is off: you can rotate the ship using the mouse. cam always stays behind the ship. key shift is on: you move the mouse and the ship does not rotate. instead, the camera rotates around the ship. you could, for example look at the ship from the right side. key shift is released: moving the mouse rotates the ship again. the camera will now stay on the right side of the ship no matter what, and stay at the right side of it, looking at the ship from the right at all times (until shift is once again pressed)...

but that's another problem...?

my problem: the sprites are always rotating by code (my.roll += tinme_step;)
now, at some position (haven't yet found out which one exactly) they suddenly start rolling much faster if you pan the camera around. they face the cam in tilt and pan, but the rolling looks like it came "closer and closer to the edge, and then suddenly falls over", that is: rolls faster. then it slows down again once it's rolled about 90 or 180 degrees. when you pan back, it does the same thing, rolling in the other direction. WHY?...
looks very strange if your whole nebula suddenly starts rolling... :'(
or is the problem really what you were talking about, vlau?
Micha


~"I never let school interfere with my education"~
-Mark Twain
Re: true facing of sprites? [Re: Germanunkol] #185955
03/04/08 14:10
03/04/08 14:10
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
It is difficult for me to solve your problem
without seeing your code + level.

Can you upload a test level and your current
camera control code? It can be a dummy spaceship
and sprites.

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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