Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, AndrewAMD), 14,749 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Camera code for Lite-C? Anyone? #295500
10/25/09 18:22
10/25/09 18:22
Joined: Aug 2005
Posts: 336
Connecticut
Galen Offline OP
Senior Member
Galen  Offline OP
Senior Member

Joined: Aug 2005
Posts: 336
Connecticut
I need Lite-C code for a basic camera. Not attached to a player, not attached to an entity. Just something to let me move my pos_000 camera around. I was able to in C-script, but since updating everything to Lite-C, I can't move.

Please, if anyone can point me to some Lite-C code for basic camera movement, I sure would appreciate it!

Re: Camera code for Lite-C? Anyone? [Re: Galen] #295507
10/25/09 18:47
10/25/09 18:47
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
here that must work;


action free_camera()
{
// c_setminmax(my);

VECTOR camera_force;
set(my,INVISIBLE|POLYGON);
// set(my,PASSABLE);

camera_force.z = 0;
vec_set(camera.x,my.x);
vec_set(camera.pan,my.pan);

while(1)
{
camera_force.x = (key_w - key_s)*10*time_step;
camera_force.y = (key_a - key_d)*10*time_step;
vec_add(my.pan,vector(mouse_force.x*(-7)*time_step,mouse_force.y*7*time_step,0));

c_move(my,camera_force,nullvector,GLIDE+IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_PUSH);
vec_set(camera.x,vector(my.x,my.y,my.z+15));
vec_set(camera.pan,my.pan);

wait(1);
}
}

Last edited by Blackchuck; 10/25/09 18:54.

I have know Gamestudio/A7 Commercial Edition 7.84
Re: Camera code for Lite-C? Anyone? [Re: Blackchuck] #295510
10/25/09 19:09
10/25/09 19:09
Joined: Aug 2005
Posts: 336
Connecticut
Galen Offline OP
Senior Member
Galen  Offline OP
Senior Member

Joined: Aug 2005
Posts: 336
Connecticut
Thank you very much for the reply!

I just tried running this though and I get an "Acknex.exe has shut down" error that I wasn't getting before.

I'll try setting some breakpoints in the script to see if I can pin down where the issue is...

Re: Camera code for Lite-C? Anyone? [Re: Galen] #295511
10/25/09 19:12
10/25/09 19:12
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
no problem


I have know Gamestudio/A7 Commercial Edition 7.84
Re: Camera code for Lite-C? Anyone? [Re: Blackchuck] #295513
10/25/09 19:19
10/25/09 19:19
Joined: Aug 2005
Posts: 336
Connecticut
Galen Offline OP
Senior Member
Galen  Offline OP
Senior Member

Joined: Aug 2005
Posts: 336
Connecticut
Okay, I think my mistake was just adding it to my main level .c file, so instead I made a separate file and did an "#include" on it and that stopped the crashing. However when my level loads I still can't move around. I looked for a way to attach the free_camera action to my pos_000 camera, but there doesn't seem to be any option for doing so.

Am I just missing something basic here? Should I be using something other than pos_000 for my camera?

Re: Camera code for Lite-C? Anyone? [Re: Blackchuck] #295515
10/25/09 19:29
10/25/09 19:29
Joined: Aug 2005
Posts: 336
Connecticut
Galen Offline OP
Senior Member
Galen  Offline OP
Senior Member

Joined: Aug 2005
Posts: 336
Connecticut
Okay, I removed the pos_000 and added a model and assigned the free_camera action to it, and it works!!!!


THANK YOU!

Re: Camera code for Lite-C? Anyone? [Re: Blackchuck] #295533
10/25/09 21:18
10/25/09 21:18
Joined: Aug 2005
Posts: 336
Connecticut
Galen Offline OP
Senior Member
Galen  Offline OP
Senior Member

Joined: Aug 2005
Posts: 336
Connecticut
Oh, one quick question:
I'm trying to make the camera isometric, via:
camera.flags |= ISOMETRIC;
but it doesn't seem to be working. Any tips on how to apply this to the script you supplied? I tried adding it in after the vec_set statements but it didn't make a difference.

Re: Camera code for Lite-C? Anyone? [Re: Galen] #295630
10/26/09 16:18
10/26/09 16:18
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
Hmmm...
The only functions you can use with "flag" is;

VISIBLE;
OVERLAY;
TRANSLUCENT;
FILTER;
LIGHT;

(It stays like that in the handbook)

but try it with "var ISOMETRIC;" also;

action free_camera()
{

VECTOR camera_force;
var ISOMETRIC;// Give it to a var
set(my,INVISIBLE|POLYGON);
camera.flags |= ISOMETRIC;// Now no errors should show up

camera_force.z = 0;
vec_set(camera.x,my.x);
vec_set(camera.pan,my.pan);

while(1)
{
camera_force.x = (key_w - key_s)*10*time_step;
camera_force.y = (key_a - key_d)*10*time_step;
vec_add(my.pan,vector(mouse_force.x*(-7)*time_step,mouse_force.y*7*time_step,0));

c_move(my,camera_force,nullvector,GLIDE+IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_PUSH);
vec_set(camera.x,vector(my.x,my.y,my.z+15));
vec_set(camera.pan,my.pan);

wait(1);
}
}

Not tested.
Hope it helped

Last edited by Blackchuck; 10/26/09 16:29.

I have know Gamestudio/A7 Commercial Edition 7.84
Re: Camera code for Lite-C? Anyone? [Re: Blackchuck] #295631
10/26/09 16:25
10/26/09 16:25
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
@Blackchuck, who the hell told you that?(k, before the edit, there was a clear statement that, you should NOT set ISOMETRIC as a flag, but as a var.)

ISOMETRIC is a flag. and Galen is doin it right.

@Galen, what do you mean by it doesn't seem to be working? be more clear(screenshots?), so we can help better.

Last edited by Quadraxas; 10/26/09 16:26.

3333333333
Re: Camera code for Lite-C? Anyone? [Re: Quad] #295632
10/26/09 16:27
10/26/09 16:27
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
Sorry I changed my post.

I reed "ISOMETRIC" wrong blush


I have know Gamestudio/A7 Commercial Edition 7.84
Page 1 of 3 1 2 3

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

Gamestudio download | 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