Skip to content

Instantly share code, notes, and snippets.

View tracend's full-sized avatar
🎯
Focusing

✌ Makis Tracend tracend

🎯
Focusing
View GitHub Profile
@tracend
tracend / ParticleExplosion.js
Created March 30, 2011 00:06
Unity3D: Make a particle explosion when bullets hit - Source: http://wiki.dreamsteep.com/Unity_tools
var explody_pf :Transform;
function explody (){
var instancedbullet =Instantiate( explody_pf ,transform.position,Quaternion.identity);
//instancedbullet.rigidbody.AddForce(transform.forward * shootForce);
}
@tracend
tracend / SmoothFollow.js
Created March 30, 2011 00:07
Unity3D: This camera smoothes out rotation around the y-axis and height - Source: http://wiki.dreamsteep.com/Unity_tools
/*
This camera smoothes out rotation around the y-axis and height.
Horizontal Distance to the target is always fixed.
There are many different ways to smooth the rotation but doing it this way gives you a lot of control over how the camera behaves.
For every of those smoothed values we calculate the wanted value and the current value.
Then we smooth it using the Lerp function.
Then we apply the smoothed values to the transform's position.
*/
@tracend
tracend / SmoothLookAt.js
Created March 30, 2011 00:09
Unity3D: Camera script to smoothly look at any direction - Source: http://wiki.dreamsteep.com/Unity_tools
var target : Transform;
var damping = 6.0;
var smooth = true;
@script AddComponentMenu("Camera-Control/Smooth Look At")
function LateUpdate () {
if (target) {
if (smooth)
{
@tracend
tracend / Bounce.js
Created March 30, 2011 00:10
Unity3D: Simple Bouncing movement - Source: http://wiki.dreamsteep.com/Unity_tools
function OnCollisionEnter (collisionInfo : Collision) {
// print (collisionInfo.gameObject.tag) ; //??? HTH DO I TAG?
// print (collisionInfo.gameObject.transform.position) ;
// if (collisionInfo.gameObject.tag=="sphere"){
@tracend
tracend / FollowObject.js
Created March 30, 2011 00:18
Unity3D: Follow and object - Source: http://wiki.dreamsteep.com/Unity_ai
var waypoint: Transform;
var speed: float = 15;
function Update () {
var target:Vector3 = waypoint.position;
var moveDirection: Vector3 = target -transform.position;
var velocity = rigidbody.velocity;
@tracend
tracend / AvoidObject.js
Created March 30, 2011 00:20
Unity3D: Raycast object avoidance - Source: http://wiki.dreamsteep.com/Unity_ai
var target : Transform;
function Update(){
//the direction vector to target
var dir = (target.position - transform.position).normalized;
var hit :RaycastHit;
if (Physics.Raycast(transform.position,transform.forward,hit ,20)){
//no self collision
if(hit.transform !=transform)
@tracend
tracend / .htaccess
Created April 2, 2011 07:19
Wordpress: Almost Perfect htaccess File for WordPress blogs - Source: http://www.josiahcole.com/2007/07/11/almost-perfect-htaccess-file-for-wordpress-blogs/
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
@tracend
tracend / swipe.as
Created April 2, 2011 12:01
AS3: Using the Swipe Gesture in Flash Using ActionScript 3.0 - Source: http://www.republicofcode.com/tutorials/flash/as3swipegesture/
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
square_mc.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
function onSwipe (e:TransformGestureEvent):void{
if (e.offsetX == 1) {
//User swiped towards right
square_mc.x += 100;
$data = array("a" => $a);
$ch = curl_init($this->_serviceUrl . $id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($data));
$response = curl_exec($ch);
if(!$response) {
bool inputPlayer1Kick = Input.GetButtonUp("Player1Kick");
bool inputPlayer2Kick = Input.GetButtonUp("Player2Kick");
if(true == inputPlayer1Kick)
{
// player 1 kicked
}
if(true == inputPlayer2Kick)
{
//player 2 kicked