Anyway I can have it control the force through my melee script?
Fumbling through some code. Something along the lines of this?
[code]CharacterController controllerPush = other.gameObject.GetComponent<CharacterController>();
Vector3 horVel = controllerPush.velocity;
horVel = new Vector3 (controllerPush.velocity.x, 0, controllerPush.velocity.z);
float horForce = horVel.magnitude;
horForce = force;[/code]
[img]https://dl.dropboxusercontent.com/u/3975474/mayathingy.JPG[/img]
[img]https://dl.dropboxusercontent.com/u/3975474/vectorfieldthingy.JPG[/img]
[img]https://dl.dropboxusercontent.com/u/3975474/vfield_test.gif[/img]
So I think it works now. Basically I wrote a c++ program that will convert UE4 vectorfield files into 3D textures.
It actually produces some really pretty stuff.
Did some work on a character controller for my asteroid game: [URL]https://dl.dropboxusercontent.com/u/13781308/Unity/Asteroid Game/Asteroid Game.html[/URL]
Movement is nice and smooth and feels pretty good but the system breaks vertical movement like gravity and jumping. Here's the code:
[code]float moveSpeed;
Vector3 inputDirection = Vector3.zero;
// Sprint
if ( Input.GetKey( KeyCode.LeftShift ) )
moveSpeed = playerSettings.sprintSpeed;
else
moveSpeed = playerSettings.walkSpeed;
// Forward
if ( Input.GetKey( KeyCode.W ) )
inputDirection += Vector3.forward;
// Backward
if ( Input.GetKey( KeyCode.S ) )
inputDirection += -Vector3.forward;
// Strafe Left
if ( Input.GetKey( KeyCode.A ) )
inputDirection += -Vector3.right;
// Strafe Right
if ( Input.GetKey( KeyCode.D ) )
inputDirection += Vector3.right;
// Clamp input to magnitude 1
inputDirection = Vector3.ClampMagnitude( inputDirection, 1 );
// Apply movement speed
inputDirection = inputDirection * moveSpeed;
// Get the desired velocity in world space
inputDirection = transform.TransformDirection( inputDirection );
// Remove velocity that is vertical with respect to the player (prevents sideways falling)
Vector3 charRigidbodyVelocity = characterRigidbody.transform.InverseTransformDirection( characterRigidbody.velocity );
charRigidbodyVelocity.y = 0;
charRigidbodyVelocity = characterRigidbody.transform.TransformDirection( charRigidbodyVelocity );
// Lerp the desired velocity to get smooth movement
Vector3 lerpedVelocity = Vector3.Lerp( charRigidbodyVelocity, inputDirection, 0.1f );
// Apply the desired movement
characterRigidbody.velocity = lerpedVelocity;[/code]
Any idea how I could get the same good-feeling movement without locking up "vertical" movement?
[editline]22nd May 2014[/editline]
Also, the webplayer may not work on Windows 8. It works on my win7 desktop but not my win8.1 laptop. This is what it looks like on my laptop: [URL]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-05/2014-05-22_17-11-34.png[/URL]
[editline]22nd May 2014[/editline]
I should probably make note that this is a character controller for walking around a sphere so there is no distinct up/down axis.
[img]http://i.imgur.com/r8iOUA5.png[/img]
[img]http://i.imgur.com/ITsTFHr.png[/img]
So, with all the Freespace I've been playing lately I decided to try something silly. I wanted to make a Freespace 2 flight simulator.
Freespace has a very "dumb" flight model. It's completely devoid of any physics and is instead based on completely arbitrary maths. Copying it turned out to be more challenging than I thought, but still pretty easy once I got into the groove of things. The goal was to recreate Freespace's physics as close as possible, ideally to the point where you can literally just plug in the numbers from Freespace's ship table and get the same exact results you would if you were to play Freespace.
I've recreated and imported two ships based on their table files. The iconic GTF Hercules and the GTC Leviathan. The Hercules flies and feels [I]exactly[/I] like the real one. The afterburner, the time it takes to turn, the inertia you feel when rotating the ship, it's all there. I even ported over the sounds, which gave me much needed practice with audio. The sound really ties it together and makes afterburning and throttling up really satisfying.
The Hercules in here is working with the same exact values (same max velocity, same damp, same turn rates, etc). I referenced the source code for the game's weirdest and most specific physics effect: the way the damping works. The simple three line formula they use for damping motion is the core of why Freespace feels the way it does.
Something funny when working on it was that I felt like what flight sim devs must feel like whenever they work on flight models. To double check the results I had a stopwatch and timed different maneuvers in the Hercules in FS2, alt-tabbed back to my version of the Hercules, and then performed the same maneuvers to see if they matched. The numbers are now close enough that I'm positive any error just comes from timing it by hand.
There's no mouse/joystick controls yet. It's only keyboard for now. The majority of the keybindings are ripped right from Freespace's defaults.
Controls:
[code]
Backspace 0% throttle
[ 33% throttle
] 66% throttle
\ 100% throttle
Tab Afterburner
Arrow keys Turning
A Temporary 100% throttle
Z Temporary 0% throttle
Q Roll left
E Roll right
C Cockpit/Third person
D Detach camera (only works in third person)
Numpad Detached camera controls[/code]
[unity]https://dl.dropboxusercontent.com/u/15133164/Freespace%20Simulator/Bin%20Web.unity3d[/unity]
[QUOTE=AtomiCal;44840263][IMG]http://puu.sh/8OxyU.png[/IMG]
What is Gfx.WaitForPresent and why is it being a bitch on my kindle fire HD 7?
Vsync is off, it's a 2d game[/QUOTE]
It's similar to Vsync, but it's graphical wise. It's waiting for the next draw batch.
I had a similar issue like that, it means that your game is performing faster than usual.
I'm dabbling in Unity shaders and I made a rimlight that's dependant on both the view direction and the light direction, but it only works with direction lights.
Direction Light, here the light is reflected correctly:
[img]http://puu.sh/8Y7Gn.jpg[/img]
With point lights, or spot lights, the direction of the rimlight gets more correct the further away the light is, and it's way too intense
[img]http://puu.sh/8Y7Vs.jpg[/img]
Anyone know how to fix this?
[QUOTE=FalconKrunch;44888958]I'm dabbling in Unity shaders and I made a rimlight that's dependant on both the view direction and the light direction, but it only works with direction lights.
Direction Light, here the light is reflected correctly:
[img]http://puu.sh/8Y7Gn.jpg[/img]
With point lights, or spot lights, the direction of the rimlight gets more correct the further away the light is, and it's way too intense
[img]http://puu.sh/8Y7Vs.jpg[/img]
Anyone know how to fix this?[/QUOTE]No idea if it will help but I hope you are normalizing your vectors.
[QUOTE=dije;44889636]No idea if it will help but I hope you are normalizing your vectors.[/QUOTE]
Yes, if they weren't normalized it should mess up with the directional light as well.
I know it sounds cheezy, but I feel like I wanted to create a "Forge" world, a mode similar to Halo Reach style, where you can pick up, modify objects, and place them in a pre-existing world map.
I feel like I want to expand my programming a bit more on this one.
[QUOTE=Skibur;44890482]I know it sounds cheezy, but I feel like I wanted to create a "Forge" world, a mode similar to Halo Reach style, where you can pick up, modify objects, and place them in a pre-existing world map.
I feel like I want to expand my programming a bit more on this one.[/QUOTE]
Forge mode was the shit in Halo 3. In Reach it was either all small detail props and no good construction props, or the other way around. You should do it though
So what are some good ways of increasing performance in Unity?
I really want to show somebody my project and get feedback on how I'm doing things, like if I am doing audio the right way and scripts and all.
First time project and the code has to be good. Anybody mind having a look when they have some time?
[QUOTE=Over-Run;44890950]So what are some good ways of increasing performance in Unity?
I really want to show somebody my project and get feedback on how I'm doing things, like if I am doing audio the right way and scripts and all.
First time project and the code has to be good. Anybody mind having a look when they have some time?[/QUOTE]
[url]https://docs.unity3d.com/Documentation/Manual/OptimizingGraphicsPerformance.html[/url]
and you could maybe put the code up for people to look at freely
Thanks for that.
Right now the project is up on BitBucket but it's private, at the request of my supervisor. I can invite anybody interested in helping me out though
So I was looking into releasing my game... Android was relatively simple to set up and was only a $25 registration fee. But I was also thinking about releasing for ios since unfortunately it is half the market. I am disgusted that apple has the nerve to ask for $99 a year to be able to compile games for the app store. This is extremely shit for new developers starting off.. There's already the price for things like unity pro and the adobe creative suit and all of that .. Why an extra $99 a year to upload to ios?
Is there a work around or what?
Grr, second time this month my computer powered off. Both times, in the middle of Unity taking forever to compile a shader.
[editline]23rd May 2014[/editline]
Make that three times - same shader. WTF?
[QUOTE=KillaMaaki;44893462]Grr, second time this month my computer powered off. Both times, in the middle of Unity taking forever to compile a shader.
[editline]23rd May 2014[/editline]
Make that three times - same shader. WTF?[/QUOTE]
What kind of shader are you trying to make? I have shader forge and I could make something you want to work with.
[QUOTE=FalconKrunch;44888958]I'm dabbling in Unity shaders and I made a rimlight that's dependant on both the view direction and the light direction, but it only works with direction lights.
Direction Light, here the light is reflected correctly:
[img]http://puu.sh/8Y7Gn.jpg[/img]
With point lights, or spot lights, the direction of the rimlight gets more correct the further away the light is, and it's way too intense
[img]http://puu.sh/8Y7Vs.jpg[/img]
Anyone know how to fix this?[/QUOTE]
If you post the shader source we could maybe help.
[QUOTE=pinecleandog;44893415]So I was looking into releasing my game... Android was relatively simple to set up and was only a $25 registration fee. But I was also thinking about releasing for ios since unfortunately it is half the market. I am disgusted that apple has the nerve to ask for $99 a year to be able to compile games for the app store. This is extremely shit for new developers starting off.. There's already the price for things like unity pro and the adobe creative suit and all of that .. Why an extra $99 a year to upload to ios?
Is there a work around or what?[/QUOTE]
You could jailbreak, I suppose. Also note that you need a mac/hackintosh to compile the XCode project that Unity generates (unless this has changed since 1-2 years ago).
Can anyone tell me why my game crash when I try to open it? I used a old edition of unity and then I updated Unity. So after I updated unity I tried to open the game but It wont It will just crash.
Does anybody know where I can find a model similar to this?
[url]http://u3d.as/content/code-this-lab/little-girl-zombie/4m0[/url]
Except for free.
I need the model to have like a scream animation because I want the enemy to scream at the player when looked at. And I don't have 50 euro to spend on a model.
[QUOTE=Over-Run;44895558]Does anybody know where I can find a model similar to this?
[url]http://u3d.as/content/code-this-lab/little-girl-zombie/4m0[/url]
Except for free.
I need the model to have like a scream animation because I want the enemy to scream at the player when looked at. And I don't have 50 euro to spend on a model.[/QUOTE]
You could try your luck with [url]http://tf3dm.com/search/?q=zombie&format=All+Formats&search=Search[/url]
Finally got Lux to import without powering off my computer o.O
Made my first barrel. Modeled in Blender, textured with Photoshop CC and free version of Quixel dDo.
I'm normally a programmer, so this is a bit out of my comfort zone. There's also a lot wrong with the barrel... like for instance crappy normal map. Next time I'll bake a high poly version instead of trying to half-ass it.
Shots are rendered from Unity.
[IMG]http://forum.unity3d.com/attachment.php?attachmentid=101523&d=1400943032[/IMG]
[IMG]http://forum.unity3d.com/attachment.php?attachmentid=101524&d=1400943033[/IMG]
[IMG]http://forum.unity3d.com/attachment.php?attachmentid=101525&d=1400943034[/IMG]
[IMG]http://forum.unity3d.com/attachment.php?attachmentid=101526&d=1400943035[/IMG]
[QUOTE=Skibur;44890482]I know it sounds cheezy, but I feel like I wanted to create a "Forge" world, a mode similar to Halo Reach style, where you can pick up, modify objects, and place them in a pre-existing world map.
I feel like I want to expand my programming a bit more on this one.[/QUOTE]
I've actually been working on this exact concept.
STOP STEALING MY IDEAS
I have a powerup that moves to the player when you look at it.
When it touches the player it plays a sound and gets destroyed.
I have a script that shoots a raycast from the player to detect when he is looking at the powerup. When it sees the powerup, it Starts a Coroutine.
Here is the code for the coroutine
[code] IEnumerator MoveLightPowerup(RaycastHit hit){
float startTime = Time.time;
while(Time.time - startTime <= 1){
if(hit.collider.gameObject != null){
hit.transform.position = Vector3.Lerp(hit.transform.position, transform.position, Time.time - startTime);
yield return 1;
}
}
}[/code]
The problem I am having is that once the powerup gets destroyed, I get a few null reference exceptions saying:
MissingReferenceException: The object of type 'SphereCollider' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.get_gameObject () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/UnityEngineComponent.cs:171)
PlayerLookingAt+<MoveLightPowerup>c__Iterator0.MoveNext () (at Assets/Scripts/Player/PlayerLookingAt.cs:38)
I'm not sure how to make it stop doing this?
[QUOTE=Over-Run;44896500]I have a powerup that moves to the player when you look at it.
When it touches the player it plays a sound and gets destroyed.
I have a script that shoots a raycast from the player to detect when he is looking at the powerup. When it sees the powerup, it Starts a Coroutine.
Here is the code for the coroutine
[code] IEnumerator MoveLightPowerup(RaycastHit hit){
float startTime = Time.time;
while(Time.time - startTime <= 1){
if(hit.collider.gameObject != null){
hit.transform.position = Vector3.Lerp(hit.transform.position, transform.position, Time.time - startTime);
yield return 1;
}
}
}[/code]
The problem I am having is that once the powerup gets destroyed, I get a few null reference exceptions saying:
MissingReferenceException: The object of type 'SphereCollider' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.get_gameObject () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/UnityEngineComponent.cs:171)
PlayerLookingAt+<MoveLightPowerup>c__Iterator0.MoveNext () (at Assets/Scripts/Player/PlayerLookingAt.cs:38)
I'm not sure how to make it stop doing this?[/QUOTE]
Do
[code]
if (hit.collider != null)
[/code]
instead of
[code]
if(hit.collider.gameObject != null)
[/code]
That didn't work it just froze my whole game
[QUOTE=Asgard;44894046]If you post the shader source we could maybe help.[/QUOTE]
[code]Shader "Custom/PlRimLight" {
Properties {
_MainColor ("Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_RimColor("Rim Color", Color) = (1,1,1,1)
_RimPower("Rim Power", Range(0.01,8.0)) = 1.5
_FresnelPower("Fresnel Power", Range(0.01,8.0)) = 1.5
}
SubShader {
Tags { "RenderType"="Opaque"}
LOD 200
CGPROGRAM
#pragma surface surf RimLight
fixed _RimPower;
float4 _RimColor;
fixed _FresnelPower;
inline fixed4 LightingRimLight ( SurfaceOutput s, half3 lightDir, half3 viewDir, half atten )
{
fixed3 halfVector = normalize(normalize(lightDir) + normalize(viewDir));
//Diffuse Light
fixed NdotL = max(0,dot(s.Normal, lightDir));
//Reflection
fixed NdotH = max(0,dot(s.Normal, halfVector));
fixed NdotE = max(0,dot(s.Normal, viewDir));
//Rim Light
fixed rimLight = 1.0 - NdotE;
rimLight = pow(rimLight, _FresnelPower) * NdotH;
fixed4 finalColor;
finalColor.rgb = (s.Albedo * _LightColor0.rgb + (rimLight * _RimColor.rgb)) * (NdotL * atten);
finalColor.a = 0.0;
return finalColor;
}
sampler2D _MainTex;
fixed4 _MainColor;
struct Input {
float2 uv_MainTex;
float3 viewDir;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb * _MainColor;
o.Alpha = c.a;
//half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
//o.Emission = _RimColor.rgb * pow (rim, _RimPower);
}
ENDCG
}
FallBack "Diffuse"
}
[/code]
It's not really all that interesting.
I've read up about it, and it seems I need to do multiple passes, one for normal vertex lights such as directional lights(Which it is doing now), and another one for pixel lights. But when I try and add a pass, I get a syntax error when defining my own lighting pass.
Can someone help me with this?
Are there any resources on creating networked multiplayer games?
Specifically on how to have your unity program act as both a client and server
[QUOTE=Richy19;44898646]Are there any resources on creating networked multiplayer games?
Specifically on how to have your unity program act as both a client and server[/QUOTE]
Unity Docs
[URL]https://docs.unity3d.com/Documentation/Components/NetworkReferenceGuide.html[/URL]
[URL]https://docs.unity3d.com/Documentation/ScriptReference/Network.html[/URL]
A good tutorial I followed
[URL]http://www.palladiumgames.net/tutorials/unity-networking-tutorial/[/URL]
A sample networking project I made for personal reference (poorly commented but may help a little)
[URL]https://dl.dropboxusercontent.com/u/13781308/Unity/Unity - Networking Sample Project.zip[/URL]
Edit: this is all with Unity's default networking, not any third party networking solutions
[QUOTE=Richy19;44898646]Are there any resources on creating networked multiplayer games?
Specifically on how to have your unity program act as both a client and server[/QUOTE]
There are plenty of resources and documentation for the network solutions that have been made for Unity ( uLink, Photon, even Unity's default networking ), I'm sure that if you looked through the documentation for that stuff, you would find what you are looking for.
Sorry, you need to Log In to post a reply to this thread.