![](/uploads/1/2/6/5/126576840/624597699.jpg)
3D sound
Returns: real Description. You can use this function to get the value of the different axes from a given gamepad. The return value will be between -1 and 1 for each of the available horizontal and vertical axes (the constants used by this function can be found listed here). Designing Games with GameMaker The joystick. (-1 to 1) of the x-axis of joystick id. Joystickypos(id) Returns the joysticks y-position. Joystickzpos(id) Returns the joysticks z-position (if it has a z-axis). Joystickrpos(id) Returns the joysticks rudder position (or fourth axis).
This functionality is only available in the Pro Edition of Game Maker.3D sounds refers to sound that has a position (and velocity) with respect to the listener.Although its most prominent use is in 3D games you can also effectively use it in 2D games.The idea is that a sound has a position in space.In all functions the listener is assumed to be at position (0,0,0). The systemcalculates how the listener would hear the sound and adapt it accordingly. The effect isespecially good when you have a good speaker system but is already works on small speakers.
Besides a position, the sound can also has a velocity. This leads to well-knowndoppler effects which are correctly modelled. Finally the sound can have anorientation and, again, the sound is adapted accordingly.
Game Maker supports 3D sound options through the functions below.They only work for sound resources that were indicated to be 3D. (The disadvantage is that3D sounds will be mono, not stereo.)
sound_3d_set_sound_position(snd,x,y,z)Sets the position of the indicated sound with respect tothe listener to the indicated position in space.Values on the x-axis increase from left to right, on the y-axis from down to up,and on the z-axis from near to far. The values are measured in meters. The volumewith which the sound is heard depends on this measure in the same way as inthe real world.
sound_3d_set_sound_velocity(snd,x,y,z)Sets the velocity of the indicated sound to the indicated vector in space.Please note that setting the velocity does not mean that the position changes.The velocity is only used for calculating doppler effects. So if you want to movethe sound you must yourself change the position of the sound.
sound_3d_set_sound_distance(snd,mindist,maxdist)Sets the minimum distance at which the sound does no longer increase inloudness and the maximum distance at which the sound can no longer be heard.So when the distance lies between 0 and the minimum distance the soundis at maximal amplitude. When between the minimal distance and the maximaldistance the amplitude slowly decreases until either the maximal distanceis reached or the sound is anyway no longer audible. Default the minimumdistance is 1 meter and the maximal distance is 1 billion meters.
sound_3d_set_sound_cone(snd,x,y,z,anglein,angleout,voloutside)Normally sound has the same amplitude at a given distance in all directions.You can set the sound cone to change this and make sound directional. x,y,z specifythe direction of the sound cone. anglein specifies the inside angle. Ifthe listener is inside this angle it hears the sound at its normal volume. angleoutspecifies the outside angle. When the listener is outside this the volume is indicatedwith voloutside. To be precise, voloutside is a negative numberthat indicates the number of hundreds of decibel that must be subtracted from theinside volume. Between the inside and outside angle the volume gradually decreases.
![Axis Axis](/uploads/1/2/6/5/126576840/123496368.png)
![Game maker z axis 1 Game maker z axis 1](/uploads/1/2/6/5/126576840/685203808.jpg)
Firstly, in Unity the Y axis is the vertical axis. I suspect you would save yourself a few headaches if you did things this way instead.If you don't want to change things though, then I suspect a simple transform.LookAt(transform.position + movement, Vector3(0,0,1));inserted just before the call to Move would do the trick. The second vector parameter is since you are using a non-standard vertical axis. If you change your system to use Y as up then just remove that parameter.I can't tell exactly from your code whether this will work, since you are doing things in a fairly odd manner. You may need to remove the call to thisTransform.TransformDirection(.)transform.TransformDirection transforms a vector from local space to world space, so when you rotate your object to face the way it's travelling, the movement directions might get bunged up. I didn't realize I was doing things in such an odd manner. I should probably repair things to make things easier.
Thank you for the insight, I will attempt your fix shortly.edit: Does not work initially. The problem likely lies in the this.Transform.TransformDirection(.) section - however I am not quite sure how to address that situation exactly. If i just comment out the Transform.TransformDirection(.) section - my ship doesn't move.-How does it not work?
The ship still behaves very similarly as it did before, but instead of occasionally swopping in motions that look like the ship is turning, it is only flickering back and forth and occasionally locking on a direct path of motion in one direction (although issuing a command to turn in another direction).
![](/uploads/1/2/6/5/126576840/624597699.jpg)