Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
need help with my tps game; something about mouse distance
Topic Started: Nov 9 2007, 05:47 AM (567 Views)
RockyBee
Member
[ *  * ]
helo everyone i need some help with my game, how can i change the camera distance between the camera and character when it starts meet the wall? below is what i mean

x = character
| = wall
o = camera



this is the problem:

x | o




and this is what i wanted:

x o|




u can play around with Dr.Best's Collision Example or GTA San Andreas to see what i mean. any help would be appreciated, thanks

-RockyBee
Offline Profile Quote Post Goto Top
 
Zip
Member Avatar
Forum Leader
[ *  *  *  *  * ]
I use this in player Step event:
Code:
 

camx=camera.x
camy=camera.y
camz=camera.z

cam_ydir=90+point_direction(0,0,camera.x-x,camera.y-y)+180
cam_xdir=-point_direction(0,0,point_distance(camera.x,camera.y,x,y),camera.z+camera.height-(z+height))

dst2=min(GetDistanceToLevel(x,y,z+height,-cam_xdir,cam_ydir+180)-50,350) //-50 is the minimum camera distance to wall, 350 is the normal camera distance from object
if dst2<=camera.distance camera.distance=dst2 else camera.distance=min(camera.distance+global.time_factor*2,dst2) //global.time_factor is used to keep the game sincronized with fps
camera.perspective=2
camera.follow=id
camera.rotatex=number
camera.rotatey=number
}


PS: learn to wait a bit ;)
Sorry if i've made some errors, I'm not english!
Offline Profile Quote Post Goto Top
 
LuvGame
Advanced Member
[ *  *  * ]
Zip
Nov 9 2007, 04:43 PM
I use this in player Step event:
Code:
 

camx=camera.x
camy=camera.y
camz=camera.z

cam_ydir=90+point_direction(0,0,camera.x-x,camera.y-y)+180
cam_xdir=-point_direction(0,0,point_distance(camera.x,camera.y,x,y),camera.z+camera.height-(z+height))

dst2=min(GetDistanceToLevel(x,y,z+height,-cam_xdir,cam_ydir+180)-50,350) //-50 is the minimum camera distance to wall, 350 is the normal camera distance from object
if dst2<=camera.distance camera.distance=dst2 else camera.distance=min(camera.distance+global.time_factor*2,dst2) //global.time_factor is used to keep the game sincronized with fps
camera.perspective=2
camera.follow=id
camera.rotatex=number
camera.rotatey=number
}


PS: learn to wait a bit ;)

it didnt work on me :blink:
Offline Profile Quote Post Goto Top
 
RockyBee
Member
[ *  * ]
thanks for helping Zip :) but nothing happen when i use the code, it is still the same =[
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
Some of Zip's variables are unique to his game.
Replace camera.rotatex with camera.rotx
Replace camera.rotatey with camera.roty
Offline Profile Quote Post Goto Top
 
RockyBee
Member
[ *  * ]
$pecter
Nov 10 2007, 06:37 PM
Some of Zip's variables are unique to his game.
Replace camera.rotatex with camera.rotx
Replace camera.rotatey with camera.roty

i've done it also, but still the same..
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
$pecter
Nov 10 2007, 12:37 PM
Some of Zip's variables are unique to his game.
Replace camera.rotatex with camera.rotx
Replace camera.rotatey with camera.roty

Actually rotatex and rotatey are valid camera variables ;) :
help file
 
If perspective is 1 or 2 you can change rotatex and rotatey to give a rotation offset.

Yeah, I made that mistake also in the beginning :P, as these variables weren't clearly indicated in the help file (it's fixed in the new version).

But "number" isn't defined; you could set camera.rotatex to 0 and camera.rotatey to 180, although that still doesn't make the script work (I added it to the character object in the Collision Example).

@Zip: if you can get the script to work with the Collision Example, can you let us know how you did it? Thanks for the help :).
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Zip
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Here is the new CollisionExample:
DOWNLOAD NOW!
Sorry if i've made some errors, I'm not english!
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
Thanks for the working example :thumb_up: !
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Error loading: this is not a game maker file
:P Can someone that can open save it as a new file and upload it please ?
Isis Developer
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
Gompen
Nov 11 2007, 05:27 PM
Error loading: this is not a game maker file
:P Can someone that can open save it as a new file and upload it please ?

I was able to unrar it and load it successfully with GM 6.1... :huh:
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
It was only a gmk when i downloaded it it :wacko:
Isis Developer
Offline Profile Quote Post Goto Top
 
Zip
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Impossible, i haven't gamemaker 7 :huh:
Try downloading it again.
Sorry if i've made some errors, I'm not english!
Offline Profile Quote Post Goto Top
 
MysteriXYZ
Member Avatar
Master Matrix Masher
[ *  *  *  *  *  * ]
Gompen
Nov 11 2007, 05:54 PM
It was only a gmk when i downloaded it it  :wacko:

Are we talking about the same file :D? I downloaded CollisionExampleRevised.rar and it contains CollisionExampleGM6revised.gm6.
U3D is like candy; after extensive consumption, it's Best to brush.
Offline Profile Quote Post Goto Top
 
Gompen
Advanced Member
[ *  *  * ]
Posted Image
But i tried with ie and got it working
Isis Developer
Offline Profile Quote Post Goto Top
 
Go to Next Page
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply