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
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
3rd person shooter uber camera #137886
06/24/07 18:43
06/24/07 18:43
Joined: Mar 2006
Posts: 32
P
Puri Offline OP
Newbie
Puri  Offline OP
Newbie
P

Joined: Mar 2006
Posts: 32
well ... it isnt uber but it is alittle fun, anyways I'm working on this code
for a game of mine and I found that at some point the character needs to become transparent so you can still see where your crosshair is aimimg.

Hard for me to explain what I'm meaning-here's the code.

action player1
{
ct_45=my;
vec_for_vertex(temp, my, 218); //get temp the position of vertex #218 on this model
var movement_speed = 30; // movement speed
player = my; // I'm the player
my.invisible = off;
my.skill40 = 100; // let's store the health in skill40
while (my.skill40 > 0)
{
//camera
player.pan -= 25 * mouse_force.x * time;
camera.diameter=0; //this makes the camera passable
camera.genius=null;

vec_set(cam_centre.x,player.x); //setting new camera eye height
cam_centre.z+=(player.max_z*char_eye_height); //setting new camera centre
//calulate the xyz position of the camera
orbit_camera_dist = cos(orbit_camera_tilt)*camera_dist;
cam_pos.x = cam_centre.x - cos(player.pan)*orbit_camera_dist + 25;
cam_pos.y = cam_centre.y - sin(player.pan)*orbit_camera_dist;
cam_pos.z = cam_centre.z + sin(orbit_camera_tilt)*camera_dist;

//set pan,roll and tilt of the camera
camera.pan = player.pan;
camera.roll = 0; //zero roll
camera.tilt = -orbit_camera_tilt;

//this will tilt the camera on the y-axis of the character when the mouse is moved up/dpwn
orbit_camera_tilt -= mouse_force.y*3;
player.pan = player.pan%360;
if(orbit_camera_tilt < -45){orbit_camera_tilt = -45;}
if(orbit_camera_tilt > 90){orbit_camera_tilt = 90;}

me = player;
c_trace(cam_centre.x,cam_pos.x, ignore_me + ignore_passable + ignore_models + ignore_sprites); // if trace hits something
if(trace_hit > 0)
{
vec_diff(temp.x, cam_centre.x, target.x); //temp is vector from target to view target
vec_normalize(temp.x, 16); //camera will back off by 16 if its trace hits a wall ect.
vec_set(camera.x,target.x);
vec_add(camera.x,temp.x);
}
else
{
vec_set(camera.x,cam_pos.x ); // camera's target
}

ok..
What I'm aiming for is when your moving your mouse to aim and fire (your in 3rd person) that when the crosshair gets on your character it turns the character transparent so you can still see to aim your weapon correctly.

and yes ... my coding is ugly

Re: 3rd person shooter uber camera [Re: Puri] #137887
06/25/07 04:55
06/25/07 04:55
Joined: Mar 2006
Posts: 32
P
Puri Offline OP
Newbie
Puri  Offline OP
Newbie
P

Joined: Mar 2006
Posts: 32
I did have an idea how I might get the transparent thing working.

Maybe putting an invisble cube in the middle of the screen that pans in perfect sync with the crosshair and when it makes contact with the character it makes him/her transparent until theres no contact.

But a problem may happen, the cube more than likely will need to be passable and therefore no trigger can happen.....

Another idea is knowing the cordinates of the camera and making the character transparent if the camera is in these cordinates which I think may actually work.

Any tips?

Re: 3rd person shooter uber camera [Re: Puri] #137888
06/25/07 05:07
06/25/07 05:07
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
maybe just use in player's action
my.enable_touch = ON;
then
if(event_type == event_touch){my.transparent = on;}

Last edited by tompo; 06/25/07 05:09.

Never say never.
Re: 3rd person shooter uber camera [Re: tompo] #137889
06/25/07 07:03
06/25/07 07:03
Joined: Mar 2006
Posts: 32
P
Puri Offline OP
Newbie
Puri  Offline OP
Newbie
P

Joined: Mar 2006
Posts: 32
I've almost got it by using this code

if(camera.x > 150 )
{
my.transparent = on;
}
else
{
my.transparent = off;
}

only problem is it only kicks in when the camera orbit distance is at its max 150 distance and turns off at 140 distance, which is one area that i need it to work.

When the camera is at lets say 40 it doesnt activate again even when I tell it to so I'm in deep thought again.

maybe if i use this it might work

if(camera.x >= 150 ) && (camera.x >= 140)
{
my.transparent = on;
}
else
{
my.transparent = off;
}

if(camera.x >= 50 ) && (camera.x >= 40)
{
my.transparent = on;
}
else
{
my.transparent = off;
}

I'm not sure yet

Re: 3rd person shooter uber camera [Re: Puri] #137890
06/25/07 22:19
06/25/07 22:19
Joined: Mar 2006
Posts: 32
P
Puri Offline OP
Newbie
Puri  Offline OP
Newbie
P

Joined: Mar 2006
Posts: 32
I couldnt figure it out right so I took the simple approach.

if (key_shiftl == on)
{
my.transparent = on;
}
else
{
my.transparent = off;
}

It isnt auto but manual-minor inconvience.

I might get it automated soon tho i hope.

Re: 3rd person shooter uber camera [Re: Puri] #137891
06/26/07 05:43
06/26/07 05:43
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Goerge offers a good solution in a series of articles about 'Planet Suvivors', in AUM 36 to 45 but in particular AUM 36 and 37.

Re: 3rd person shooter uber camera [Re: Nems] #137892
06/26/07 07:52
06/26/07 07:52
Joined: Mar 2006
Posts: 32
P
Puri Offline OP
Newbie
Puri  Offline OP
Newbie
P

Joined: Mar 2006
Posts: 32
Thanks for the info, I'll take a look into it.

Re: 3rd person shooter uber camera [Re: Puri] #137893
06/26/07 15:00
06/26/07 15:00
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline
Serious User
jigalypuff  Offline
Serious User

Joined: Nov 2005
Posts: 1,007
also in morrowing, the player is transparent when the camera is a set distance from him.


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: 3rd person shooter uber camera [Re: jigalypuff] #137894
06/26/07 15:04
06/26/07 15:04
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
have you tried with touch by mouse? (so crosshair is on the player)
i've posted it above


Never say never.

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