Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Nov 2004
Offline Last Active Sep 06 2013 02:23 PM

Topics I've Started

Making a bone point to a target?

13 April 2013 - 04:33 PM

This is in unity but uses vectors and quaternions that should work the same in most libraries.






I want to make a bone look at a target point but have two problems.


1: unity uses z+ forward and blender uses x-


2: the look at should avoid excessive twisting of the bone.


public class BoneLookAt : MonoBehaviour {

	// Use this for initialization
	void Start () {
		//save rest data
		restRot = this.transform.localRotation;
			//filter input
		FowardQuaternionInverse = Quaternion.Inverse( Quaternion.LookRotation(Foward));
	public Vector3 Foward = new Vector3(-1,0,0);
	private Quaternion FowardQuaternionInverse;
	private Quaternion restRot;
	public Vector3 GetTargetPosition(){
		return this.transform.position +  (this.transform.parent.rotation * restRot) * Foward;
	public Quaternion LookAt(Vector3 v){
		 return  Quaternion.LookRotation(v-this.transform.position) * FowardQuaternionInverse;
	private Vector3 ang = new Vector3();

	void Update () {
		Debug.DrawLine(this.transform.position,this.transform.position + this.transform.rotation * Foward);
		this.transform.rotation = LookAt(GetTargetPosition());


Create xna resource files at runtime?

14 August 2012 - 12:52 AM

Is it possible to compile images or sounds into xna resource files at run time, for example so the game level editor could have new tiles added without having to recompile?

[java] java swing grid size

11 August 2011 - 04:49 PM

Right now I have a grid layout that I want to compact to its minimal size but in general all the swing components have a min, max and preferred size. How do I select what one the layout manager obeys.

[java] java internal java.lang.ArrayIndexOutOfBoundsException

19 July 2011 - 12:08 PM

How do I find the cause of a exception that was created and caught entirely within the java libraries.

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
	at javax.swing.text.BoxView.getOffset(Unknown Source)
	at javax.swing.text.BoxView.childAllocation(Unknown Source)
	at javax.swing.text.CompositeView.getChildAllocation(Unknown Source)
	at javax.swing.text.BoxView.getChildAllocation(Unknown Source)
	at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateViewPosition(Unknown Source)
	at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.layoutContainer(Unknown Source)
	at java.awt.Container.layout(Unknown Source)
	at java.awt.Container.doLayout(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validate(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

c++ directorys question

12 May 2011 - 12:19 PM

I have some programming experience but until now have been ignoring c++. I have tried both Microsoft visual c++ and code blocks but haven't use either long enough to have a preference.

First why do they both use virtual directorys? Even if I manually create directorys the IDE ignores them. Is their any way I can make it automatically match up virtual directory and namespace to the real directry structure like java, C# and actionscript do.

Secondly is their any tool to make adding 3'rd party libraries easier, like configuring a directory that that IDE automatically searches or library files to add.