Jump to content


Gamebastard

Member Since 03 May 2011
Offline Last Active Jun 02 2012 06:51 PM

Topics I've Started

moving 3d objects around camera Skyrim style

30 April 2012 - 03:30 AM

Hello, i am working on a new fps. In this game the player needs to be able to move objects using the first person camera similar to the way you pick up and move objects in games like Skyrim and Fallout. I am completely lost here. i have the object following in front of the player on the x and y using lengthdir_x and lengthdir_y, but I can't get it to follow on the pitch. So you have and idea here, 0 pitch is looking strait ahead, -2 is looking strait down and 2 is looking strait up. Right now I am using this:
with cam{
other.x=x+lengthdir_x(other.dist,cam.direction)
other.y=y+lengthdir_y(other.dist,cam.direction)
other.z=other.dist*((arctan(pitch))) 
}
//dist=distance from camera

this almost works except it is way too sensitive. when looking up and down the object goes flying in that direction drastically. I tried dividing by constants but it seems to have no effect. If you can help me out I would greatly appreciate it.  :biggrin:

smooth basic collisions?

31 December 2011 - 07:33 AM

Alright, in my past 3d games i have used collisions and  x=xprevious; y=yprevious. This is sort of the only way i know that works. Now i wrote a pretty basic script for a much smoother collision (you can only walk if the space in front of you is open) and it goes like this:

//xn/yn- x new/ ynew (the new position)
//nx/ ny- the same thing, but for moving forwards and backwards (so diagonals don't get screwed up)


// move forward
if keyboard_check(ord("W"))
{if keyboard_check(vk_shift)  // <----Sprint if holding shift
{
  nx = x + lengthdir_x(4,direction);
  ny = y + lengthdir_y(4,direction);
if !place_meeting(nx,ny,obj_basic)  //check if object in path
x=nx; y=ny;}
else
{
  nx = x + lengthdir_x(2,direction);
  ny = y + lengthdir_y(2,direction);
if !place_meeting(nx,ny,obj_basic)
x=nx; y=ny;}}

//move backwards
if keyboard_check(ord("S"))
{if keyboard_check(vk_shift)
{
  nx = x + lengthdir_x(4,direction+180);
  ny = y + lengthdir_y(4,direction+180);
if !place_meeting(nx,ny,obj_basic)
x=nx; y=ny;}
else
{
  nx = x + lengthdir_x(2,direction+180);
  ny = y + lengthdir_y(2,direction+180);
if !place_meeting(nx,ny,obj_basic)
x=nx; y=ny;}}

//strafe left
if keyboard_check(ord("A"))
{
  xn = x - sin(direction*pi/180);
  yn = y - cos(direction*pi/180);
if !place_meeting(xn,yn,obj_basic)
x=xn; y=yn;}

//strafe right
if keyboard_check(ord("D"))
{
  xn = x + sin(direction*pi/180);
  yn = y + cos(direction*pi/180);
if !place_meeting(xn,yn,obj_basic)
x=xn; y=yn;}




And this works beautifully, only it only works when i move towards the front or back face of an objects, not the left or right.  It seams strange to me, if i strafe, walk forwards, or backwards into the front or back of a cube, i collide and slide off. If i come at it from the other two sides, i go strait through. please help, i don't know why it doesn't work. feal free to complain if this doesn't belong in this category, and don't forget to play my games! (You don't have to, it would just be nice.)  :biggrin:

show_menu

08 October 2011 - 04:12 PM

I didn't exactly know where to put this, but in a game I'm working on, (Arctic Survivor II, if your curious) I use the show_menu function to interact with pretty much all items (kind of like Runescape when you right click on something). It works pretty nicely since the game is mouselook, but now i'm making functions for joystick control. I don't want players to have to click on options with the mouse every time they want to choose something. I know you can use the arrow keys and press enter to select things, but can you do this with other triggers? are there options I can set? and if so, how? If possible i would like to have the user be able to toggle through the menu options with the joystick and press A to select one. Any possibility of this? Thanks in advance.

3d texture dont match up on certain computers

31 August 2011 - 01:37 AM

Alright, it has recently come to my attention that the textures in my games may not look the same when other people play them. When I run my game ( Black and White ) for example, all the textures match up and fit the models. I am aware that textures size 64, 128 and increments of them work best, but when it comes to rectangular shaped textures, the increments sometimes need to be different for width/height. Basically, it all looks nice and perfect when I play on my computer, but when ran on my other computer (both windows 7) The textures are either segmented on flat surfaces or cut off on 3d models. When i made the game Black and White I was planning on other people having the same experience as when played on my machine, I know that different computers operate differently, like mouse sensitivity for one (which also is a problem), but i don't know what causes the textures to not match up on one. As far as I know both my computers have the same (or similar) software and updates. Has anyone else had this texture problem? If so do you know why?

help greatly appreciated.

Logic error?

08 July 2011 - 05:58 AM

Hey guys. having a bit of a problem here; in this Sword Model Maker Im making I created a series of scripts to create variables to correspond with a model of a piece of a sword. for example, it would create 3 variables when you press enter such as:
1: the X position of the model, defined as "x1-12"
2: the Y position of the model matching the X,
3: the ind of the model (all possible models of sword parts such as handles, blades, ext are defined and loaded in the create event)

heres the script run when ENTER is presses:

mod_count= the current model it's creating, if it were your first piece, mod_count would be 1, the second it would be 2, ect.
v1=show_menu("1|2|3|4|5|6|7|8|9|10|11|12",-1)

kv=v1


variable_local_set("x"+string(mod_count),0)

variable_local_set("y"+string(mod_count),0)

variable_local_set("type_"+string(mod_count),"s"+string(kv))


when it draws it it does this:
if variable_local_exists("type_1")

d3d_model_draw(type_1,x1,y1,z,background_get_texture(metal))


REAL PROBLEM:
The scripts seem to work as they should seeing it in debug mode, but it won't draw the correct model because in the create event it defines the first piece as (s1) but when drawing the variable created is actually ("s1") as a string. is there any way you can think of either changing a script into a variable name, or possibly a revision to the first script to make it work properly?